From: Joseph on
I want to make a handle for axes a variable that may change with a counter.

Callback for pushbutton...
i=i+1
h=['handles.axes_' int2str(i)]
axes(h)
....
set(h)

When I execute the above, I get: "Value must be a handle".

Thanks in advance.

Joe
From: John D'Errico on
"Joseph " <joseph.holmes(a)mail.mcgill.ca> wrote in message <i3vkmt$q5j$1(a)fred.mathworks.com>...
> I want to make a handle for axes a variable that may change with a counter.
>
> Callback for pushbutton...
> i=i+1
> h=['handles.axes_' int2str(i)]
> axes(h)
> ...
> set(h)
>
> When I execute the above, I get: "Value must be a handle".

Why do this?

Some years ago, MATLAB introduced a new concept -
vector and arrays. You can store things in those vectors
using a technique called indexing. Do it like this:

h(1)
h(2)

etc.

John
From: Joseph on
"John D'Errico" <woodchips(a)rochester.rr.com> wrote in message <i3vl9k$3td$1(a)fred.mathworks.com>...
> "Joseph " <joseph.holmes(a)mail.mcgill.ca> wrote in message <i3vkmt$q5j$1(a)fred.mathworks.com>...
> > I want to make a handle for axes a variable that may change with a counter.
> >
> > Callback for pushbutton...
> > i=i+1
> > h=['handles.axes_' int2str(i)]
> > axes(h)
> > ...
> > set(h)
> >
> > When I execute the above, I get: "Value must be a handle".
>
> Why do this?
>
> Some years ago, MATLAB introduced a new concept -
> vector and arrays. You can store things in those vectors
> using a technique called indexing. Do it like this:
>
> h(1)
> h(2)
>
> etc.
>
> John

john(1:100)=0;
please_help(question,still,stands) ;
From: ImageAnalyst on
Joseph:
Basically you call findobj() to get an array of all the axes on your
GUI/figure. You just do something like

arrayOfAllAxesHandles = findobj(gca,'Type','axes')

or something like that, and then loop through all elements of the
arrayOfAllAxesHandles array.

There are lots of other examples in the help for findobj() - it's
quite a powerful and flexible function that you should learn about.
From: Steven_Lord on


"Joseph " <joseph.holmes(a)mail.mcgill.ca> wrote in message
news:i3vkmt$q5j$1(a)fred.mathworks.com...
> I want to make a handle for axes a variable that may change with a
> counter.
>
> Callback for pushbutton...
> i=i+1
> h=['handles.axes_' int2str(i)]
> axes(h)
> ...
> set(h)
>
> When I execute the above, I get: "Value must be a handle".

While you _could_ do this using dynamic field names, I second John's
suggestion. Just store your axes handles in a vector.

--
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