I want to get data from simulink during simulation and use the serial network function to send this data to another program. Because I need to use another program to perform some tricks and send the command back to simulink, so I need to get data from simulink at runtime so that another program can make the correct command.
I tried using the Workspace block to export data.

However, I can only get value at the very beginning of the simulation.
And I also tried to use the scope and change some properties: check the Save data to workspace checkbox and clear the Limite data from Last.


First, I started modeling, and I found that ScopeData is not displayed in the workspace. Only when I stop modeling will ScopeData appear in the workspace.

And after that I can use ScopeData.signals.values ββto get the values.
But I want: when I start the simulation, ScopeData will appear in the workspace so that I can send this data to another program.
Does anyone know how to achieve this?
I found this page to be useful, but I still don't know how to constantly export data during the simulation.
Po-jen lai
source share