How to get out of the for cycle and start all over again?
조회 수: 1 (최근 30일)
이전 댓글 표시
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:
댓글 수: 0
채택된 답변
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
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!