How can I log Signals to Workspace in accelerator mode ?
조회 수: 4 (최근 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
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
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.
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');)
댓글 수: 0
참고 항목
카테고리
Help Center 및 File 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!