Holding selected iterations for a plot (but not all)

Hi,
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

 채택된 답변

Sean de Wolski
Sean de Wolski 2013년 1월 15일
편집: Sean de Wolski 2013년 1월 15일

1 개 추천

for ii = 1:100
if ismember(ii,[10 25 50 75 100]);
hold on;
plot stuff;
else
hold off;
end
end

댓글 수: 2

Alexander
Alexander 2013년 1월 15일
편집: Alexander 2013년 1월 15일
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
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.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Line Plots에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by