f



a variable containing the name of another variable inside a callback

Dear all,

I want to prepare a function that creates an uicontrol edit field
which will read the inputed values and ascribe to a certain variable.
Example:

%---------- start script code --------------------

global var1
var1=11;
editvar(var1)

%---------- end script code --------------------

the function editvar must create an uicontrol edit field
and ascribe the inputed values to the value of var1.

%----------- start function editvar ----------------------
function editvar(inputvar)
uicontrol('Style','edit'    'String', inputvar,...
    'Callback', 'sprintf(''global %s; %s=str2num(get
(gcbo,''String''))'',  inputvar,inputvar ) ' );
%----------- end function editvar ---------------------


As i understand this callback should work. I reality it doesnt! Any
idea?
Thanks in advance ...
0
Oxyopes1 (6)
6/29/2009 2:47:24 PM
comp.soft-sys.matlab 211264 articles. 25 followers. lunamoonmoon (257) is leader. Post Follow

1 Replies
893 Views

Similar Articles

[PageSpeed] 14

"Oxyopes@googlemail.com" <Oxyopes@googlemail.com> wrote in message <a8e0bcab-9a14-4a4f-99a4-73bf99fc4262@y9g2000yqg.googlegroups.com>...
> Dear all,
> 
> I want to prepare a function that creates an uicontrol edit field
> which will read the inputed values and ascribe to a certain variable.
> Example:
> 
> %---------- start script code --------------------
> 
> global var1
> var1=11;
> editvar(var1)
> 
> %---------- end script code --------------------
> 
> the function editvar must create an uicontrol edit field
> and ascribe the inputed values to the value of var1.
> 
> %----------- start function editvar ----------------------
> function editvar(inputvar)
> uicontrol('Style','edit'    'String', inputvar,...
>     'Callback', 'sprintf(''global %s; %s=str2num(get
> (gcbo,''String''))'',  inputvar,inputvar ) ' );
> %----------- end function editvar ---------------------
> 
> 
> As i understand this callback should work. I reality it doesnt! Any
> idea?
> Thanks in advance ...

If it doesn't work, what makes you think it should?
0
someone3 (1980)
6/29/2009 6:06:00 PM
Reply: