From: Dustin on
I have two axes objects in my gui, handles.Plot1 and handles.Plot2. I need to know how to switch back and forth between these to add various features and overlays as my code progresses. I tried both

axes(handles.Plot1)
set(figureName,'CurrentAxes',handles.Plot1)

but i receive the errors:

??? Error using ==> axes
Invalid axes handle

??? Error using ==> set
hggroup handle passed to 'CurrentAxes' property - valid axes handle required

I've checked the handle tags several times and i am driving myself crazy! thanks
From: Walter Roberson on
Dustin wrote:
> I have two axes objects in my gui, handles.Plot1 and handles.Plot2. I
> need to know how to switch back and forth between these to add various
> features and overlays as my code progresses. I tried both
> axes(handles.Plot1)
> set(figureName,'CurrentAxes',handles.Plot1)
>
> but i receive the errors:
>
> ??? Error using ==> axes
> Invalid axes handle
>
> ??? Error using ==> set
> hggroup handle passed to 'CurrentAxes' property - valid axes handle
> required
>
> I've checked the handle tags several times and i am driving myself
> crazy! thanks


Looks like they are not *axes* handles like you think they are. Looks like
they are the result of plotting something such as a bar chart.

get(handles.Plot1, 'Type')

will probably show you hggroup rather than axes.

To find the axes that the hggroup is embedded in, use

ancestor(handles.Plot1, 'axes')

From: Steven_Lord on


"Dustin " <dbrisset(a)gmail.com> wrote in message
news:i4152b$c1$1(a)fred.mathworks.com...
> I have two axes objects in my gui, handles.Plot1 and handles.Plot2. I need
> to know how to switch back and forth between these to add various features
> and overlays as my code progresses. I tried both
> axes(handles.Plot1)
> set(figureName,'CurrentAxes',handles.Plot1)
>
> but i receive the errors:
>
> ??? Error using ==> axes
> Invalid axes handle
>
> ??? Error using ==> set
> hggroup handle passed to 'CurrentAxes' property - valid axes handle
> required
>
> I've checked the handle tags several times and i am driving myself crazy!
> thanks

That suggests that you overwrote handles.Plot1 with the handle to an
hggroup, so it no longer contains a handle to an axes (which is what the
figure CurrentAxes property expects.) Since you haven't posted a lot of
your code, I think you're the only one who'll be able to debug this.

--
Steve Lord
slord(a)mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

From: Dustin on
> That suggests that you overwrote handles.Plot1 with the handle to an
> hggroup, so it no longer contains a handle to an axes (which is what the
> figure CurrentAxes property expects.) Since you haven't posted a lot of
> your code, I think you're the only one who'll be able to debug this.


thank you both, this is exactly what i did. thanks for telling me what to look for. ctrl+f is an amazing tool as well.