Exit code

조회 수: 13 (최근 30일)
Muhammad Arsalan
Muhammad Arsalan 2011년 4월 6일
Hi,
Can anyone help me with following:
cntr1 and cntr2 are 2 counter.
I want something like
if cntr1 == cntr2
exit the code (here i need help how to exit?)
uiwait(msgbox('Error!'));
end
Thanks in advance for help.
Kind regards. \\ Arsalan

채택된 답변

Walter Roberson
Walter Roberson 2011년 4월 6일
Why are you exiting the code before you present the Error box?
Why are you using msgbox() instead of errordlg() ?
Do you want Matlab as a whole to EXIT, or do you want to RETURN to whatever routine might have called the present one, or do you want to create an ERROR condition that throws the program back to the command prompt unless something CATCHes the error?
  댓글 수: 1
Muhammad Arsalan
Muhammad Arsalan 2011년 4월 6일
I just want to stop MATLAB from running the code if that condition is true. So i have tried "return" and it seems to work well.
if cntr1 == cntr2
uiwait(msgbox('Error!'));
return;
end
Thanks a lot for quick reply.
Best Reards, Arsalan

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by