How can I save all of the data from a simulation running in external mode to one file?
7 次查看(过去 30 天)
显示 更早的评论
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.
0 个评论
采纳的回答
Siddharth Mohan
2016-3-15
Hi Matt,
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.
Let me know if you have other questions!
Thanks,
Siddharth
2 个评论
HASHIM MM
2021-6-16
I too faced an issue with the logging. I tried the solution provided to save to mat files. For me only the first matfile is having data. The other mat files created by the trigger are all empty. When I disconnect and connect again , the first mat file after disconnect will contain the data and the rest of them generated with the triggers are all empty. Has someone faced this issue?
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!