How can I log Signals to Workspace in accelerator mode ?

3 ビュー (過去 30 日間)
Max
Max 2017 年 7 月 10 日
編集済み: Surendra Reddy Kovvuri 2022 年 2 月 15 日
Hi,
I've got a problem with logging of signals to the Workspace from Simulink to Matlab 2015b.
I choose all signals I want to log manually in Simulink. After that I activate the button "Start Logging Selected Signals to Workspace". To start the Simulation I use the command
sim('MyModelName')
If I do it like I described, I get a Dataset in the Workspace with that I can Access the logged signals.
The issue is, that if I'm starting the Simulation with a header file and the command
sim('MyModelName',SimulationMode','accelerator')
or as well
sim('MyModelName','SimulationMode','normal')
I don't receive any Output Dataset in Workspace. If I start the simulation directly in accelerator mode in Simulink via the "Play"-button, I receive a Dataset in the Workspace. So only when I change the SimulationMode manually with a script, I don't get any output signals.
Thanks in advance.
  1 件のコメント
Mitch Martelli
Mitch Martelli 2017 年 7 月 31 日
Hi, I have the same problem with a protected model, I suppose that the reason is the same since the protected model run automatically in Accelerator Mode. It is correct? Please someone from the support team could add a suggestion? Regards Mitch

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

回答 (2 件)

Dimitris Iliou
Dimitris Iliou 2017 年 7 月 13 日
The reason you are experiencing this issue is because of the way the sim function works. If you go to the corresponding documentation page:
you will notice that sim has an output that contains the simulation outputs—logged time, states, and signals.
In order to get those, you will need to use the get function. You can find more information and examples on how to use get in the following documentation page:
In short, in order to get the logged data from the Scope, I used the following code:
simout = sim('vdp_test','SimulationMode','normal');
simout.get('ScopeData')
A similar workflow can be followed if you are logging the output using the Configuration Parameters menu.
  1 件のコメント
Max
Max 2017 年 7 月 14 日
Although I logged my signals in the Configuration Parameters, I receive no Output. The SimulationOutput I get is empty, when I call the model like you suggested
simout = sim('vdp_test','SimulationMode','normal');
simout.get('ScopeData')
Only if I call the simulink-model with
sim('vdp_test')
I get an output.

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


Surendra Reddy Kovvuri
Surendra Reddy Kovvuri 2022 年 2 月 2 日
編集済み: Surendra Reddy Kovvuri 2022 年 2 月 15 日
simout = sim(data.mdlName,'SimulationMode','accelerator');
LoggedSignals=simout.get('LoggedSignals'); % logged signals through configuration
Please try this. Thank you!
Note: Comment out all scopes in your model and in accelerator mode, and click run button and at last you will get logged data as you used to find in normal mode of running with out this command line (LoggedSignals=simout.get('LoggedSignals');)

カテゴリ

Help Center および File ExchangeSave Run-Time Data from Simulation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by