MATLAB plot MarkerIndices real estate

How can I use MarkerIndices

with plot

?

x = linspace(-10,10,101);
y = sin(x);

plot(x, y,  'color', 'blue', ...
            'LineStyle','-', ...
            'Marker', 's', ...           
            'MarkerIndices', [1, 5, 10], ...        
            'MarkerEdgeColor', 'black',...
            'MarkerFaceColor','yellow');

      

Error message

Error using plot
There is no MarkerIndices property on the Line class.

Error in plotting3 (line 4)
plot(x, y,  'color', 'blue', ...

      

+3


source to share


1 answer


MarkerIndices

became available in R2016b version.

The workaround is displayed two times:

MarkerIndices = [1, 5, 10];
myplot = plot(x, y, 'b-.');
hold on;                 
mymarkers = plot(x(MarkerIndices), y(MarkerIndices), 'ro');    
legend(myplot)

      



This should work. I noted that this is about posting to the MathWorks community. A link will be provided if found.

PS This is LINK's answer ;

+3


source







All Articles