![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/174536/image.png)
Simulink "To Workspace" block only outputs last part of simulation
15 views (last 30 days)
Show older comments
I am using a "To Workspace" block in my Simulink diagram to send both time and angular position that is read from an encoder. When the simulation is stopped I only have the last few seconds of data for each variable in the workspace (although the length of all array variables are equal). My Simulink model is in external mode but it is not an issue with any of the hardware as many of my other Simulink models properly read in the entire simulation time and angle. Here is a screenshot with one of the parameters pulled up. All of the orange To Workspace blocks have the same parameter settings and the same issue.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/154355/image.png)
0 Comments
Answers (1)
Nihar Deodhar
on 28 Jun 2016
In order to limit/remove limit on the number of points you could tweak the model configuration parameters in simulations tab of the menu bar. A snapshot is attached for more details. Either uncheck or manually enter the number of points you wish to log.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/174536/image.png)
2 Comments
Nihar Deodhar
on 28 Jun 2016
Edited: Nihar Deodhar
on 28 Jun 2016
I see that you are saving Time as well to the workspace. I am not sure if the time block is limiting the data sent to the work space. But one thing you could try to do is save 'structure with time' instead of saving it as an array. I am not sure if that is causing the issue though. I would be happy to look at the model if its possible for you to upload it here.
See Also
Categories
Find more on Event Functions in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!