How can I log Signals to Workspace in accelerator mode ?

1 次查看(过去 30 天)
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-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 CenterFile Exchange 中查找有关 Save 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