This block is similar to the "To File" original simulink block, except for the following points:
1) It does not access the file system during the simulation, in fact it collects data in memory and saves them to file only when the simulation is over. This is important for real time systems, where normally access to the file system by processes running in real time has to be avoided.
2) It can save any type of data instead of just doubles.
3) It has a lot of flexibility in saving the data, different format and precisons can be selected form the block mask.
4) When using the %d, %f or %e options, the file is an ASCII file that can be opened with any text editor as well as easily loaded into matlab or excel.
This code is derived from an original s-function written by G.Campa and S.Gururajan for simulink schemes running in real time under RTAI-Linux.
Giampiero Campa (2022). savedata (https://www.mathworks.com/matlabcentral/fileexchange/9986-savedata), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform CompatibilityWindows macOS Linux
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!