Filter löschen
Filter löschen

error message in GUI

4 Ansichten (letzte 30 Tage)
ludvikjahn
ludvikjahn am 11 Mär. 2015
Beantwortet: Image Analyst am 11 Mär. 2015
good morning, I would like to have an error mesage in GUI which shows up whatever error it finds in any part of the GUI.
Is it possible to doit and, in this case, HOW?
Thanks

Antworten (1)

Image Analyst
Image Analyst am 11 Mär. 2015
Yes. Wrap your code in a try catch block. Here is the snippet:
try
% Some code that might generate an error.
catch ME
errorMessage = sprintf('Error in function %s() at line %d.\n\nError Message:\n%s', ...
ME.stack(1).name, ME.stack(1).line, ME.message);
fprintf(1, '%s\n', errorMessage); % Print to command window.
uiwait(warndlg(errorMessage)); % Popup message alert to user.
end

Kategorien

Mehr zu Propagation and Channel Models finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by