try/catch in gui
조회 수: 12 (최근 30일)
이전 댓글 표시
채택된 답변
Image Analyst
2013년 7월 1일
편집: Image Analyst
2013년 7월 1일
Just put it in a while loop until they get it right. Warn them like this:
message = sprintf('Error: you entered %d when you should have entered a number in the range [0,99].', theirNumber);
uiwait(warndlg(message));
In general for a try/catch you can try this:
function blahblahblah()
try
% Some code that generates an error.
catch ME
message = sprintf('Error in blahblahblah():\n%s', ME.message);
uiwait(warndlg(message));
end
댓글 수: 0
추가 답변 (1개)
Pourya Alinezhad
2013년 7월 1일
just check the input box you created in GUI for numbers below desired value.if input number was bigger than upper bound you can call a error message box GUI.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 MATLAB Report Generator에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!