Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to start/Stop running simulink model from GUI?

362 views
Skip to first unread message

Ketan Chhaniyara

unread,
Jun 19, 2009, 5:25:03 AM6/19/09
to
I have made a GUI for controlling a robot.

In it there is one button 'Start' to run the simulink model integrated with it.

Now I want that by pressing 'Stop' button, running simulink model should get stop and close.

How to do it. Its urgent.

KK KK

unread,
Jun 19, 2009, 5:43:01 AM6/19/09
to
hi... check this it might b helpful...
http://blinkdagger.com/matlab/matlab-gui-tutorial-integrating-simulink-model-into-a-gui?

"Ketan Chhaniyara" <ketan.ch...@vvpedulink.ac.in> wrote in message <h1flhf$7g5$1...@fred.mathworks.com>...

Phil Goddard

unread,
Jun 19, 2009, 11:20:19 AM6/19/09
to

The given link is a good example of running a simulation over a given period of time (i.e. assuming you know the stop time in advance).
However if you want to start a model and run it until you press a stop button, then you need to use the commands
set_param('modelName','SimulationCommand','start');
and
set_param('modelName','SimulationCommand','stop');
as part of appropriate button callback routines.
Typically you would set the stop time to Inf so that the model runs infinitely (unless the stop button is pressed).

Search the doc for "SimulationCommand" and "SimulationStatus" to read more on how these commands work.

There are a number of examples which you can find doing an internet search, one would be
http://www.mathworks.com/matlabcentral/fileexchange/24294

Phil.

Ketan Chhaniyara

unread,
Jun 21, 2009, 10:21:01 AM6/21/09
to
Thank you.

"Phil Goddard" <philN...@goddardconsulting.ca> wrote in message <h1gabj$ntq$1...@fred.mathworks.com>...

0 new messages