필터 지우기
필터 지우기

Return to a for loop in the middle of code?

조회 수: 1 (최근 30일)
Jennifer
Jennifer 2011년 3월 26일
In the middle of my code, I have a little GUI that pops up asking for an input. Based on the number that is given, matrix manipulations are carried out. Once these lines of code are finished, I then want to return back to the same GUI, input a different number, which changes the matrices, and perform the same manipulations with this different data. How can I pop out of the program and return to a specific line in the middle of the program again?
Thanks!

채택된 답변

Walter Roberson
Walter Roberson 2011년 3월 27일
The mechanism to execute some code and return to the same place you left off is to call a function or execute a script. There is no way to jump to a specific line, no GOTO and not likely ever to be. There is a Matlab File Exchange contribution that simulates GOTO, but it is inadvisable.

추가 답변 (1개)

Paulo Silva
Paulo Silva 2011년 3월 26일
while 1
%your code
%if the user presses cancel or something on the GUI that asks for input
%break
end
  댓글 수: 1
Jennifer
Jennifer 2011년 3월 29일
Thanks to you both, I appreciate it. As I looked at this code again, I decided a function was the way to go.

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

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by