How do i pause simulink for a moment ?

I trying to create a continuous plotting Application Programming Interface (aka API)which keep collecting results from the stimulation produce by simulink. The problem is simulink only produce the result after it stop or pause, any idea of pausing it?

 採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 1 月 23 日

1 投票

set_param('yourmodel','simulationcommand','pause')
see also, 'continue','stop','update',...

7 件のコメント

Kelvin Oys
Kelvin Oys 2013 年 1 月 25 日
where do i type this in? In callback function of simulink?
Kelvin Oys
Kelvin Oys 2013 年 1 月 25 日
Let say the simulink is in a inf time, and i wanted the simulink to pause and update the mat file every 5 min.
Azzi Abdelmalek
Azzi Abdelmalek 2013 年 1 月 25 日
No, not in callback function, In your m-file.
%To start simulation
set_param('yourmodel','simulationcommand','start')
%To pause simulation
set_param('yourmodel','simulationcommand','pause')
%Do whatever you want
%Then continue simmulation
set_param('yourmodel','simulationcommand','continue')
Kelvin Oys
Kelvin Oys 2013 年 1 月 29 日
What if the simulink is exe form? For example i complie the GUI into an exe file then i compile the mdl file into a exe also. Before compiling it works fine in matlab, after it compile into exe file the pause function start or pause function just won't work.
Walter Roberson
Walter Roberson 2013 年 1 月 29 日
Simulink cannot be compiled into an exe as such: the closest you can get is to use Simulink Coder which compiles to C code.
MATLAB compiler and Simulink Coder are not intended to be able to work together.
TAB
TAB 2013 年 1 月 29 日
Simulink APIs works only under matlab environment. It is not possible to coontrol compiled model with these APIs. Also same is true for vice versa. Simulink APIs are not supported by matlab compiler. So they will not work with you standalone GUI.
For your reference: This relares thread and This tech doc
Gerrit
Gerrit 2018 年 8 月 13 日
Please note that the link to "This tech doc" no longer works.

サインインしてコメントする。

その他の回答 (1 件)

TAB
TAB 2013 年 1 月 25 日

1 投票

Instead of puasing the simulation to collect data, use run time data access methods of simulink. Using these methods data can be collected when the simulation is running.
See

カテゴリ

ヘルプ センター および File ExchangeConfigure and View Diagnostics についてさらに検索

質問済み:

2013 年 1 月 23 日

コメント済み:

2018 年 8 月 13 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by