Clear Filters
Clear Filters

How to export simulink data to workspace during simulation?

13 views (last 30 days)
Hi, I want to retrieve the data from simulink during simulation, and use serial function to send these data to other applications.
I've tried using To Workspace block to export the data.
However, I can only got value in the very beginning of the simulation.
I've found this page http://www.mathworks.com/help/simulink/ug/exporting-simulation-data.html, but I still don't know how to continuously export data during simulation.
EDIT: Use scope and change some properties: check Save Data To Workspace and Uncheck Limite data to Last seems to be getting the data from simulink when the simulation stop.
First, I started simulation, and I found the ScopeData didn't appear in the Workspace. Only when I stop simulation, ScopeData would appear in workspace.
And after that, I can use ScopeData.signals.values to get values.
But what I want is: when I start simulation, ScopeData would appear in workspace so that I can send these data to other program.
Does anyone know how to achieve this?
  2 Comments
piyush raj
piyush raj on 11 Oct 2016
Check out this link. Might be helpful. If anybody can suggest anything else please do.
https://www.google.co.in/url?sa=t&rct=j&q=&esrc=s&source=web&cd=3&cad=rja&uact=8&ved=0ahUKEwit5ebbwdPPAhVGqI8KHXz_BcgQFggjMAI&url=http%3A%2F%2Fwww.mathworks.in%2Fhelp%2Fsimulink%2Fug%2Faccessing-block-data-during-simulation.html&usg=AFQjCNG_lCxik62CAKPW9q-nhKPkq4ornA&sig2=9VTeF8PFlGBOVP8gIDXNMQ

Sign in to comment.

Accepted Answer

Azzi Abdelmalek
Azzi Abdelmalek on 8 Jun 2013
There are several ways to export your data to workspace
  1. you can use a scope where you will change some properties: check Save Data To Workspace and Uncheck Limite data to Last
  2. Use a to Workspace Block
  3. Use a to File block, which you can load after simulation
  2 Comments
Po-Jen
Po-Jen on 8 Jun 2013
Edited: Po-Jen on 9 Jun 2013
I misinterpreted the results, I can only get data after stopping the simulation, but what I want is getting data during runtime and send these data to another program so that the program can get the correct data it needs.

Sign in to comment.

More Answers (0)

Categories

Find more on Simulink Functions in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!