Question
Hello, I am using a Simulink model to control a small robot. The model is compiled using the Real-Time Windows Target (ERT), and runs in external mode for 100 seconds. I have disabled the "limit data points to last" setting in the scope as well as in the configuration parameters, but the scope will only save to the workspace and display the last 10 seconds of simulation time. Additionally, the "ToFile" block is not supported by the real-time windows target. How can I save all of the data from my simulation? Is there a different block I can use? Thank you for your help, I have spent a lot of time trying to solve this problem already.
Expert Answer
Kshitij Singh
PhD Expert
Answered Aug 27, 2026
We've heard this request from customers before and we have it in our plans to address it sometime in the future. For now, you can save the complete simulation data using the 'External Mode Control Panel'. You can do it in two different ways.
1) Increase the External mode trigger duration.
If you have a finite running simulation, you can change the External mode trigger duration to log more data. From your model, go to Code->External Mode Control Panel-> Signal & triggering -> Duration. Set this to a number that might be enough for you to capture the simulation data. Please note that some targets might limit you to have a specific trigger duration.
2) Saving simulation data to MAT files
You can also save simulation data to MAT file(s). The number of MAT files generated will depend on the 'External mode trigger duration'. For example: If the trigger duration is set to 100 and the complete simulation generates 200 data points, you will get two MAT files. The first will have data stored in a variable from T1 -> T100 and the second will have data from T101 -> T200. You can follow the steps below to try this out.
a) Code -> External Mode Control Panel -> Data Archiving
b) Check the 'Enable archiving' box.
c) In the 'Directory' edit box, specify a directory where you'd like to save the MAT file(s)
d) In the 'File' edit box, enter a name for your MAT file.
100% Run Guarantee
3-Hour Fast-Track Delivery
Need a Custom Version or Complete Simulation for This Problem?
Our 500+ PhD engineers build, debug, and optimize working MATLAB scripts and Simulink (.slx) models tailored to your exact assignment rubrics with zero plagiarism.
Tested on MATLAB R2024b / R2026a
Turnitin 0% Plagiarism Report
Free 7-Day Revisions Guarantee
Have a different question? Ask here
Related real-time windows ... Questions & Solutions
Browse All →
Explore similar technical troubleshooting questions and verified MATLAB solutions:
Ready-to-Run MATLAB & Simulink Projects
Browse All Projects →