Info
This question is closed. Reopen it to edit or answer.
how i can call back the value that come out at comand window to do if else command to dialog box
1 view (last 30 days)
Show older comments
i wanted to do a dialog box for GUI, where the dialog box will explain to me the type of error...to know what type of error its depend on the value that i got from previous step..the value come out in command window...how i can call the data from comand window to relate it with dialog box?
so how i can do that...???
0 Comments
Answers (1)
Geoff Hayes
on 17 May 2015
Nur - you could try using lasterror or a try and catch block around your code to capture any errors that may occur. If doing the latter, you could try something like
try
A = randi(255,12,12);
fprintf('%d',A(13,1)); % accessing an invalid element of A
catch mException
errordlg(mException.message);
end
In the above code, we try to access an invalid element of the 12x12 matrix A. When this occurs, an exception is thrown and a dialog (see predefined dialog boxes) is shown with the text Index exceeds matrix dimensions which would be the same text that would be written to the Command Window.
I think that wrapping your code in a try and catch block is a neat way to handle errors that you can catch and display to the user.
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!