How to get out of the for cycle and start all over again?

조회 수: 1 (최근 30일)
Simone Fratton
Simone Fratton 2019년 10월 19일
댓글: Walter Roberson 2019년 10월 20일
Good morning,
first of all I apologize for my poor English, however:
I have to run a matlab program already done, this program is given some inputs (a = 1, B = 2 ...), then I with an if cycle check if the results are good. If the results are not good I want you to update the inputs (for example put a = a + 1 etc.) and then go back to the lines of the previous program to redo the calculations again. What I can't do is go back to a previous line in the program. Can someone help me?
To get a better understanding of what the problem is, I will give an example:
P_matlab.png

채택된 답변

Walter Roberson
Walter Roberson 2019년 10월 19일
a = 1;
while true
B = a*23+54 ;
if B < 89
a = a+1;
continue;
end
end
Or more cleanly,
a = 1;
B = a*23+54 ;
while B < 89
a = a + 1;
B = a*23+54 ;
end
  댓글 수: 2
Simone Fratton
Simone Fratton 2019년 10월 19일
I'm looking for a way to start again from line 2, ok that in the example the problem could be so, but a command start from ... just doesn't exist?

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by