MATLAB Answers


Value of handles.axes in MATLAB GUI

Asked by Chethan on 27 Apr 2013

What value will get stored in handles.axes if image is present and if the image is not present? I want check the condition whether image is present or not, and i implemented this

    if handles.axes1==0
    msgbox('Please insert image. . .', 'Error. . .');

but this is not working, please suggest me the best way of doing this.


Log in to comment.

1 Answer

Answer by Walter Roberson
on 27 Apr 2013
 Accepted Answer

You could try

if ~ishandle(handles.axes1)

However, if the axes exists but does not contain an image, the axes will still be a handle. But you can test

if isempty(findobj(handles.axes1, 'type', 'image'))

to see whether the axes contains an image

  1 Comment

Thank you and it is working, but what does 'type' indicates in above code?

Log in to comment.

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

MATLAB Academy

New to MATLAB?

Learn MATLAB today!