|
On Jun 19, 9:05 am, "Jose " <jose.l.v...@gmail.com> wrote:
> "Jose " <jose.l.v...@gmail.com> wrote in message <h1gbvh$bf...@fred.mathworks.com>...
> > Hello everyone, I am running a main program and I want to
> > insert a gui function to stop it.
>
> > It look like very obvious that it cant so complicated, but I have problems with it:
>
> > The main program:
>
> > clear all
> > clc
> > global x
>
> > x=1
>
> > while 1
> > hstoprun=uicontrol (gcf,'String','stop','Position',[20,40,60,20],'Callback','stoprun');
>
> > if x==0
> > break
> > end
>
> > end
>
> > This is the gui-function.
>
> > XXXXXXXXXXXXXXXXx
> > function stoprun (obj, event, string_arg)
> > global snrtest
>
> > x=0
>
> > XXXXXXXXXXXXXXXX
>
> > The weird thing is that the gui-function (stoprun) do not return the new value x=0 to the main program.
>
> > And therefore the main program don't stop
>
> > Any idea, why the new value of x don't return to the main program?
>
> > Cheers,
>
> > Jose.
>
> > Sorry, there is a mistake in my post, global x,
>
> but I have still the same problem.
>
>
could you put x as a global in there too? (Just off the top of my
head, that's what i see might help)
function stoprun (obj, event, string_arg)
global snrtest x
x=0
|