Can I use the 'To File' block in a Speedgoat simulation with Simulink Real-Time?

14 views (last 30 days)

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 31 Mar 2025
Edited: MathWorks Support Team on 31 Mar 2025
No. In general, the 'To File' block is used for simulation on desktop and is not recommended for code generation workflows, as documented in the "Extended Capabilities" section of the block documentation:
The block will in fact not perform any functionality when used in a simulation with Simulink Real-Time (SLRT) and Speedgoat.

Try This Workaround

Instead, use recommended signal logging options for SLRT such as file logging and live streaming to Simulation Data Inspector (SDI).
For the file logging approach, file logs are written to the Speedgoat target SSD for robust and lossless data logging. File logs can be automatically imported into MATLAB's SDI when stopping a run, and will create a 'logsout' variable in the workspace by default for later post-processing and export to file. However, note that the raw data recorded on the target SSD is binary and can only be viewed in MATLAB's SDI, and there is no way to directly save the file logs in a different portable format.
For the live-streaming approach, signal data can be viewed in SDI while the simulation is running, and exported to MAT, XLSX, or MLDATX file or post-processed after stopping the recording. See the links below for more details:
For more information on file I/O in Speedgoat real-time simulations, see:

More Answers (0)

Tags

No tags entered yet.

Community Treasure Hunt

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

Start Hunting!