MATLAB Answers

Holding selected iterations for a plot (but not all)

4 views (last 30 days)
I am creating a plot within a loop and holding all calculations at present with 'hold on' . I would like to only hold selected iterations of my loop in order to make my plot clearer. i.e. if I am running my calculations for 1:100years I might select to plot 10, 25, 50, 75, 100 years.
Many thanks, Alex


Sign in to comment.

Accepted Answer

Sean de Wolski
Sean de Wolski on 15 Jan 2013
Edited: Sean de Wolski on 15 Jan 2013
for ii = 1:100
if ismember(ii,[10 25 50 75 100]);
hold on;
plot stuff;
hold off;


Alexander on 15 Jan 2013
Thank you very much. This has solved my problem. Do you know how to edit the properties of these individual additions to the plot. i.e. label them and change the line style/colour
Cheers, Alex
Sean de Wolski
Sean de Wolski on 15 Jan 2013
You could just use plottools:
>>plottools on
To do it programatically you would need to store the line handles and then tool around with them.

Sign in to comment.

More Answers (0)

Sign in to answer this question.

Translated by