From: Jose on
Hello to everyone, there another way to pass all the variables sm.... through the function timerFun instead of define them as global?..thanks in advance.


function prueba

t1 = timer('TimerFcn',@timerFun,'executionmode','fixedrate');
start(t1);

global sm_ack
global sm_init
global sm_startmove
global sm_endmove
global sm_adc
global sm_elpsn
%






% receive the variable1
sm_ack=6
sm_init=5;
sm_startmove=1;
sm_endmove=2;
sm_adc=3;
sm_elpsn=4;








function timerFun(obj,~)

hstop=uicontrol (gcf,'String','Stop','Position',[10,10,60,20],'Callback','stoprun');
end

end
From: us on
"Jose " <jose.l.vega(a)gmail.com> wrote in message <i1aes1$81b$1(a)fred.mathworks.com>...
> Hello to everyone, there another way to pass all the variables sm.... through the function timerFun instead of define them as global?..thanks in advance.
> function prueba
> t1 = timer('TimerFcn',@timerFun,'executionmode','fixedrate');
> start(t1);
> global sm_ack
> global sm_init
> global sm_startmove
> global sm_endmove
> global sm_adc
> global sm_elpsn
> %
> % receive the variable1
> sm_ack=6
> sm_init=5;
> sm_startmove=1;
> sm_endmove=2;
> sm_adc=3;
> sm_elpsn=4;
> function timerFun(obj,~)
>
> hstop=uicontrol (gcf,'String','Stop','Position',[10,10,60,20],'Callback','stoprun');
> end
>
> end

a hint:
- peruse the docs on how to create/use callback functions...

http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_prog/f9-39541.html#f9-42494

us
From: Jose on
thanks, something like that
t1 = timer('TimerFcn',{@timerFun,sm_ack,sm_init,sm_start.move,sm_endmove,sm_adc,sm_elpsn},'executionmode','fixedrate');

It os too long I think, i need to write dowm some function.m for this kind of variables sm...something like sm.m

"us " <us(a)neurol.unizh.ch> wrote in message <i1afig$jic$1(a)fred.mathworks.com>...
> "Jose " <jose.l.vega(a)gmail.com> wrote in message <i1aes1$81b$1(a)fred.mathworks.com>...
> > Hello to everyone, there another way to pass all the variables sm.... through the function timerFun instead of define them as global?..thanks in advance.
> > function prueba
> > t1 = timer('TimerFcn',@timerFun,'executionmode','fixedrate');
> > start(t1);
> > global sm_ack
> > global sm_init
> > global sm_startmove
> > global sm_endmove
> > global sm_adc
> > global sm_elpsn
> > %
> > % receive the variable1
> > sm_ack=6
> > sm_init=5;
> > sm_startmove=1;
> > sm_endmove=2;
> > sm_adc=3;
> > sm_elpsn=4;
> > function timerFun(obj,~)
> >
> > hstop=uicontrol (gcf,'String','Stop','Position',[10,10,60,20],'Callback','stoprun');
> > end
> >
> > end
>
> a hint:
> - peruse the docs on how to create/use callback functions...
>
> http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_prog/f9-39541.html#f9-42494
>
> us