Why I can not save all the simulation data using to workspace in simulink's external mode?

7 views (last 30 days)
Hello,
I am using external mode on Simulink to get real-time values from a Humusoft data adquisition board.
The thing is that when I ran the simulation it loses data from time to time (I have set fixed step time to 10us and a discrete solver).
This could be more or less solved if I can store all the data coming from de board, but when I try to use to workspace block it stores only the last values, ranging from 600 to 900 points (this number is never the same).
Does anyone know why is this happening and a possible way to solve it?
Thanks in advance.
Amina

Answers (1)

Dimitri MANKOV
Dimitri MANKOV on 1 Dec 2022
Edited: Dimitri MANKOV on 1 Dec 2022
Hello Amina,
I do not recommend using the "To Workspace" block to log data in Simulink Real-Time. If you're using MATLAB R2020a or earlier, try using the "File Scope" block instead. In case you're using MATLAB R2020b or later, the "File Log" block could be of interest.
In either case, you are also welcome to try the Simulation Data Inspector (SDI) to log data. SDI is fully compatible with Simulink Real-Time.
I hope this is helpful!
Dimitri

Community Treasure Hunt

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

Start Hunting!

Translated by