Matlab GUI - Error check and message accordingly

4 ビュー (過去 30 日間)
Vineet Guru
Vineet Guru 2013 年 6 月 4 日
I have seen several videos on GUIs showing how to do this but when I attempted it, the error display box (tag = msg) does not display an error if anything other than numeric values are inserted into the boxes.
I'll be delighted if someone can help me with this.
I have uploaded the code here from where it can be downloaded.
The files you will need are the m file, the fig file and the .xlsx file
Thank You

採用された回答

Image Analyst
Image Analyst 2013 年 6 月 4 日
You could use a try/catch like this:
try
% Some code that might generate an error.
catch ME
errorMessage = sprintf('Error in function blah_blah_blah().\n\nError Message:\n%s', ME.message);
fprintf(1, '%s\n', errorMessage);
uiwait(warndlg(errorMessage));
end
  1 件のコメント
Vineet Guru
Vineet Guru 2013 年 6 月 5 日
Thanks Image Analyst. I'll attempt your solution.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDownloads についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by