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:
Gui question

Subject: Gui question

From: Benjamin Couillard

Date: 2 Feb, 2011 18:30:06

Message: 1 of 2

Hi everyone,

I'm rather new to Matlab GUI development so I thought you guys could
help me out.

We have designed a simple GUI to wrap some m-file simulation function
(let's call it "my_sim_function" that can take up to 10 minutes to
process. However, to simplify the data manipulation we have decided to
try using a gui to use the "my_sim_function".

When I press the button "Run", "my_sim_function" is called. The GUI
is pretty much frozen during the time and I'd like to be able to stop
the m-file function by clicking of the "Stop" button. The thing is,
since the function takes 10 minutes to complete, the stop button
function never gets called and the only way to stop the whole thing is
by using "CTRL+C".

Is there a (simple) way to use the GUI to stop "my_sim_function"
without using CTRL+C.

Best regards

Subject: Gui question

From: Sean de

Date: 2 Feb, 2011 18:54:04

Message: 2 of 2

Benjamin Couillard <benjamin.couillard@gmail.com> wrote in message <85e39998-
> When I press the button "Run", "my_sim_function" is called. The GUI
> is pretty much frozen during the time and I'd like to be able to stop
> the m-file function by clicking of the "Stop" button. The thing is,
> since the function takes 10 minutes to complete, the stop button
> function never gets called and the only way to stop the whole thing is
> by using "CTRL+C".
>
> Is there a (simple) way to use the GUI to stop "my_sim_function"
> without using CTRL+C.

One way would be to have my_sim_function() check the handle of the stop button every few seconds (perhaps with a timer) and if the the value of the stop button is true then stop. Then it's not the call_back of the stop button that does the stopping but the my_sim_function itself.

Tags for this Thread

No tags are associated with 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