From: Steven Lord on

"John " <jfishbac(a)gmail.com> wrote in message
news:i1n55e$ltp$1(a)fred.mathworks.com...
> "Steven Lord" <slord(a)mathworks.com> wrote in message
> <i1n2gc$rts$1(a)fred.mathworks.com>...

*snip*

> Okay steve I understand what you are saying. I DON'T understand how to
> used GUIDATA, especially when I have an array of handles. For instance, my
> handles structure for each axes created in my GUI (using GUIDE) is:
>
> handles.PLOTaxes(1)
> handles.PLOTaxes(2)
> handles.PLOTaxes(3)
> handles.PLOTaxes(4) ... and so on.

That's PART of the handles structure, the part that corresponds to the axes
you plot into. But surely there are other elements in your handles
structure, those corresponding to the other axes and buttons and "things" in
your GUI, right?

> I tried GUIDATA(hObject, handles.PLOTaxes) where hObject is the PLOT
> button. Should I be using something other than hOBject? Do I need to
> somehow refer to each element of the handles.PLOTaxes array?

What does GUIDATA's reference page say it expects as input? [It's the first
paragraph in the Description section.]

http://www.mathworks.com/access/helpdesk/help/techdoc/ref/guidata.html

Also note the blue box that starts with "GUIDE Uses guidata". If you're
using GUIDE for your GUI, you definitely should read that.

The command you pasted above overwrites whatever was stored in the GUIDATA
for your GUI with JUST the vector of plot handles. That's not what you
want, though, is it? You want _the entire handles structure_ to be stored.
So do that.

guidata(hObject, handles)

--
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: John on
"Steven Lord" <slord(a)mathworks.com> wrote in message <i1nj82$dqt$1(a)fred.mathworks.com>...
>
> "John " <jfishbac(a)gmail.com> wrote in message
> news:i1n55e$ltp$1(a)fred.mathworks.com...
> > "Steven Lord" <slord(a)mathworks.com> wrote in message
> > <i1n2gc$rts$1(a)fred.mathworks.com>...
>
> *snip*
>
> > Okay steve I understand what you are saying. I DON'T understand how to
> > used GUIDATA, especially when I have an array of handles. For instance, my
> > handles structure for each axes created in my GUI (using GUIDE) is:
> >
> > handles.PLOTaxes(1)
> > handles.PLOTaxes(2)
> > handles.PLOTaxes(3)
> > handles.PLOTaxes(4) ... and so on.
>
> That's PART of the handles structure, the part that corresponds to the axes
> you plot into. But surely there are other elements in your handles
> structure, those corresponding to the other axes and buttons and "things" in
> your GUI, right?
>
> > I tried GUIDATA(hObject, handles.PLOTaxes) where hObject is the PLOT
> > button. Should I be using something other than hOBject? Do I need to
> > somehow refer to each element of the handles.PLOTaxes array?
>
> What does GUIDATA's reference page say it expects as input? [It's the first
> paragraph in the Description section.]
>
> http://www.mathworks.com/access/helpdesk/help/techdoc/ref/guidata.html
>
> Also note the blue box that starts with "GUIDE Uses guidata". If you're
> using GUIDE for your GUI, you definitely should read that.
>
> The command you pasted above overwrites whatever was stored in the GUIDATA
> for your GUI with JUST the vector of plot handles. That's not what you
> want, though, is it? You want _the entire handles structure_ to be stored.
> So do that.
>
> guidata(hObject, handles)
>
> --
> 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
>


Steve,

I finally understand the handles structuring now (I'm new at this as of a couple weeks ago). My last question (for a while, I swear!) is how does the handles structure get passed? Is it linear? Do I have to follow a specific order? For example...
I add handles.AXES(i) to the handles structure in the "PLOT Button" callback, and then, using GUIDATA(handles.PLOTbutton), I add ADDITIONAL handles to the structure in the "CLEAR Button" callback. Then...drumroll please...I add EVEN MORE handles in the "MODIFY Button" callback. At this point, do I use GUIDATA(handles.PLOTbutton) or GUIDATA(handles.CLEARbutton) or are they both the same?

Thanks.