Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

To resolve issues starting MATLAB on Mac OS X 10.10 (Yosemite) visit: http://www.mathworks.com/matlabcentral/answers/159016

ERRORDLG icon switching to ploted graph

Asked by Lawson Hoover on 5 Dec 2012

When I run my code with the errordlg, It pulls up and works but when the icon, which is usually a x with a red circle disappears and is replaced with the graph that I plot later on in the function. Here is the errordlg code that I use.

if isnan(Beam.Width) == 1 || isnan(Beam.Height) == 1 || isnan(Beam.Thickness) == 1 || isnan(Beam.Magnitude) == 1
    errordlg('Make sure all input is a number!');    
end

0 Comments

Lawson Hoover

Products

No products are associated with this question.

1 Answer

Answer by Arthur on 5 Dec 2012
Accepted answer

You mean that you get the plot inside the errordlg?? That's weird... I cannot reproduce this, not even when I explicitly use the errordlg handle to plot. But the only reason I can think of, is that your errordlg becomes the current axes. Do you specify in which axes your plot should be made?? Like this:

plot(axesHandle,X,Y) %make plot in axesHandle

This prevents this kind of problems, and is usually faster than plotting to the gca.

Also, with dlgs like errordlg is is usually preferred that the user has to close it, before the script continues. This way you make sure that the user has seen that there is a problem. And when the dlg is closed, it will not be used to plot your data in ;).

uiwait(errordlg('Make sure all input is a number!')); %uiwait pauses the program, use has to close the dlg

1 Comment

Lawson Hoover on 5 Dec 2012

Thank You! it works now and I like the uiwait function.

Arthur

Contact us