Borrar filtros
Borrar filtros

How can I log Signals to Workspace in accelerator mode ?

8 visualizaciones (últimos 30 días)
Max
Max el 10 de Jul. de 2017
Editada: Surendra Reddy Kovvuri el 15 de Feb. de 2022
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 comentario
Mitch Martelli
Mitch Martelli el 31 de Jul. de 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

Iniciar sesión para comentar.

Respuestas (2)

Dimitris Iliou
Dimitris Iliou el 13 de Jul. de 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 comentario
Max
Max el 14 de Jul. de 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.

Iniciar sesión para comentar.


Surendra Reddy Kovvuri
Surendra Reddy Kovvuri el 2 de Feb. de 2022
Editada: Surendra Reddy Kovvuri el 15 de Feb. de 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');)

Categorías

Más información sobre Save Run-Time Data from Simulation en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by