For loop nested plotting

조회 수: 1 (최근 30일)
Ileana Gonzalez
Ileana Gonzalez 2019년 12월 8일
댓글: Ileana Gonzalez 2019년 12월 8일
figure
plot(T,Cost)
Hi,
I have an overall for loop and then there are three nested for loops (one nested loop for each graph). I'm using linspace to run through 10 iterations for the three for loops and when I run my code I get 30 graphs. How do I only get the last three graphs from the 10th iteration?
Thank you.

채택된 답변

Jesus Sanchez
Jesus Sanchez 2019년 12월 8일
Use a if-else expression:
if current_iteration == 10
plot(T,cost)
end
  댓글 수: 1
Ileana Gonzalez
Ileana Gonzalez 2019년 12월 8일
Thank you so much!!!!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Specifying Target for Graphics Output에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by