Making graph at the every for loop

조회 수: 1 (최근 30일)
Najam us Saqib Fraz
Najam us Saqib Fraz 2020년 10월 20일
댓글: uzzi 2022년 11월 1일
I have a for loop,which runs for 14 times.After the end of each loop it produces a plot,which means that whole program produces 14 plots.I don't want 14 plot,but each line on single graph.A one plot that have 14 lines at it.
  댓글 수: 1
uzzi
uzzi 2022년 11월 1일
Dear Najam us Saqib Franz,
I am creating a loop eveery 6000 rows from my table and creating a plot for each loop. Can you help me with the looping code, please? I attached my quesstion below.
https://de.mathworks.com/matlabcentral/answers/1837548-repetitively-running-the-code-and-selectively-plotting?s_tid=prof_contriblnk

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

답변 (1개)

Star Strider
Star Strider 2020년 10월 20일
First, if you are defining each plot in a separate figure, remove the figure call in the loop and put it before the loop.
Just after the figure call before the loop, use the hold function:
figure
hold on
for ...
...
end
hold off
legend
or something similar.
That should do what you want.
  댓글 수: 1
uzzi
uzzi 2022년 11월 1일
Dear Star Strider,
I am creating a loop eveery 6000 rows from my table and creating a plot for each loop. Can you help me with the looping code, please? I attached my question below.
https://de.mathworks.com/matlabcentral/answers/1837548-repetitively-running-the-code-and-selectively-plotting?s_tid=prof_contriblnk

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

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by