The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Losing access to MATLAB GUI axes handle after clearing it's image
Replies: 2   Last Post: Sep 11, 2013 1:22 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]

Posts: 2,359
Registered: 12/6/04
Re: Losing access to MATLAB GUI axes handle after clearing it's image
Posted: Sep 11, 2013 12:30 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"Greg " <> wrote in message <l0q12j$qs2$>...
> In my GUI axes (axes1) I initialize my GUI with a logo thusly:
> function axes1_CreateFcn(hObject, eventdata, handles)
> % hObject handle to axes1 (see GCBO)
> % eventdata reserved - to be defined in a future version of MATLAB
> % handles empty - handles not created until after all CreateFcns called
> logo = imread('ARA_Logo.jpg');
> imshow(logo)
> % Hint: place code in OpeningFcn to populate axes1
> In a later button press I want to clear the logo and then replace it. I first clear the logo like this:
> arrayfun(@cla,findall(0,'type','axes'));
> I plot some data to another axes like this (which works fine):
> axes(handles.axes2);
> imshow(images.img1)
> I then switch back to axes one and try to plot like this:
> axes(handles.axes1)
> imshow(compimage)
> I get the following error:
> Reference to non-existent field 'axes1'.
> The only difference between the successful plot in axes2, and the failure in axes1, is I initialize a figure in the create function of axes1.

I don't see how you can "switch back to axes one" once you delete it with the cla command. (That's what the error message is telling you.)

Perhaps you can simply hide the axes one stuff (i.e., set its Visible property to off). Then after you replace it, reset the axes one Visible property back to on (unhide it).

> Any advice?

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.