How can I log Signals to Workspace in accelerator mode ?

1 view (last 30 days)
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 Comment
Mitch Martelli
Mitch Martelli on 31 Jul 2017
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

Sign in to comment.

Answers (2)

Dimitris Iliou
Dimitris Iliou on 13 Jul 2017
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 Comment
Max
Max on 14 Jul 2017
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.

Sign in to comment.


Surendra Reddy Kovvuri
Surendra Reddy Kovvuri on 2 Feb 2022
Edited: Surendra Reddy Kovvuri on 15 Feb 2022
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');)

Categories

Find more on Save Run-Time Data from Simulation in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!