Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
running different process in a GUI

Subject: running different process in a GUI

From: Jose

Date: 21 Aug, 2009 11:53:02

Message: 1 of 1

Hello to everyone,

I have the next code:

%Main program...show a figure with two bottons 1 and 2.

figure

 p1=uicontrol (gcf,'String','1','Position',[10,10,60,20],'Callback','process1');
 
 p2=uicontrol (gcf,'String','2','Position',[10,50,60,20],'Callback','process2');

function process1 (obj, event, string_arg);
run questiongui
return

function process2 (obj, event, string_arg);
run questiongui2
return

%questiongui: Run cos(x)
 i=0;
 x=0;
 figure
 while 1
        i=i+1;
        xdin=i*0.1;
        drawnow
        x=[x xdin];
        y=cos (x);
        plot(x,y)
       end

%questiongui2: The same, with y=sin(x)


When I run the main program, appear figure 1 with two bottoms, if I press 1, appear another figure (figure2) running the cos(x)..it is ok.

But, my problem is, when I come back with my mouse to the figure 1 to press the bottom 2, the process running in figure 2 is stopped, and keep going running in the figure 1 (where I have the two bottoms).

I would like to keep the process running in figure 2, and in the same time able to move my mouse to the figure 1 to press the bottom 2, without any process running as backgroung in figure 1.

Some ideas?

Thnaks in advance,

Jose.

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us