|
"Matt Fig" <spamanon@yahoo.com> wrote in message <hngla5$goi$1@fred.mathworks.com>...
> Rather than using strings, I would tend to use vectors, something like this:
>
>
>
> function [] = examp()
>
> f = figure;
> S.mycheckbox(1) = uicontrol(f,'Style','checkbox',...
> 'String','0',...
> 'Value',0,'Position',[50 275 30 20]);
>
> S.mycheckbox(2) = uicontrol(f,'Style','checkbox',...
> 'String','1',...
> 'Value',1,'Position',[50 290 30 20]);
> S.mypushbutton = uicontrol(f,'Style','pushbutton',...
> 'string','Pushme',...
> 'callback',{@callb,S});
>
> function [] = callb(H,E,S)
>
> for ii=1:2
> V(ii) = get(S.mycheckbox(ii),'value');
> % Or V = get(S.mycheckbox(:),'value') -- no loop needed.
> end
> V % Show on command line.
>
>
>
> Now if you really want to use strings, you could use the 'tag' property of the objects and couple this with FINDOBJ to access the handle.
Thanks alot Matt, I have resorted to using the vectors instead works perfect!
CF
|