Main Content

Real-Time File Logging and Streaming Workflow

You can get signal data into the Simulation Data Inspector through logging by using a File Log block or through streaming by marking a signal for logging in the model or selecting a signal for streaming in the Simulink Real-Time Explorer.

Signal logging through a File Log block provides options that let you control:

  • The number of file logs that are retained on the target computer

  • Whether file log data is auto imported into the Simulation Data Inspector

  • Whether file log data is exported into the base workspace

You can configure these options by using the option for the real-time application start(tg) function or by using the Run in Real-Time selection in the Simulink Real-Time Explorer or the Simulink Editor. The File Logging and Streaming Workflow figure shows how these options configure operation of the real-time application start(tg) function. Where startRecording and stopRecording appear in the figure, you can use either these functions or the corresponding Start Recording and Stop Recording buttons on the Real-Time tab in the Simulink Editor or in the Simulink Real-Time Explorer.

File Logging and Streaming Workflow

While the real-time application is running, you can control file logging from File Log blocks:

  • Default logging logs signal data for the entire simulation run.

  • Enable or disable file logging by using the Enable File Log block in the model. If the model includes an Enable File Log block, the startRecording function and stopRecording function control only streaming, not logging.

  • Enable or disable file logging by using the startRecording function or stopRecording function. These function also enable or disable streaming. Alternatively, you can use the Start Recording button and Stop Recording button on the Real-Time tab in the Simulink Editor or in the Simulink Real-Time Explorer.

You can stop file logging:

After file logging stops, the setting of the AutoImportFileLog name-value argument determines whether file log data is automatically imported into the Simulation Data Inspector or whether you use the import(tg.FileLog) function to import the data.

Automatic import of the file log is handled differently by the workflows in the Recording Workflow figure:

  • For all of the workflows, the automatic import operation occurs when the real-time application stops.

  • For the Recording workflow, the automatic import operation also occurs when the stopRecording function is called.

See Also

| | | | | |

Related Examples

More About