try/catch in gui
15 ビュー (過去 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!