File Logging Basics: What is the difference between using the Start/Stop Recording API, an Enable File Log block, or Enabled Subsystems to control file logging?

26 visualizzazioni (ultimi 30 giorni)
What is the difference between using the following approaches to control file logging on my Speedgoat target with Simulink Real-Time (SLRT) in R2020b through R2025b?
  1. start/stopRecording API
  2. 'Enable File Log' block
  3. Enabled Subsystems

Risposta accettata

MathWorks Support Team
MathWorks Support Team il 25 Nov 2025 alle 0:00
Modificato: MathWorks Support Team il 25 Nov 2025 alle 8:43

1. Start/Stop Recording API

Starting in R2022b, the Start/Stop Recording API enables you to control all instrumentation in your model, including file logging and live streaming to the Simulation Data Inspector (SDI), as long as there is no 'Enable File Log' block in your model (see next section).
You can interact with this API using the startRecording and stopRecording functions, as well as the 'Start Recording' and 'Stop Recording' buttons in Simulink Toolstrip, SLRT Explorer, and custom SLRT app.
Use the Start/Stop Recording API if:
  • You want a single, unified control for both file logging and live streaming.
  • You want to control recording from outside the application—by an operator or a script—rather than triggering it from within the model using a signal.
  • You want finished file logs to be imported automatically into MATLAB while the simulation is running via 'AutoImportFileLog'

2. 'Enable File Log' block

To enable signal-based control of file logging, you can add an Enable File Log Block to your model.
Use an Enabled File Log block if:
  • You need to enable or disable file logging globally from within the model using a control signal (i.e., logging is triggered by model logic or an external signal acquired by I/O modules).
  • You want to have separate controls for file logging and live streaming.
  • Your target is running in standalone mode (i.e., without a connected MATLAB session or SLRT app).
  • You want to have the option of both interactive (operator-driven) and non-interactive (automated or signal-driven) control of file logging.
If an Enable File Log block is present in the model, the following limitations apply:
  • The Start/Stop Recording API will only affect Live Streaming.
  • Automatically importing finished file logs during a simulation run is not possible. 'AutoImportFileLog' will only import the latest log, so it is recommended to disable the option. You can, however, manually import the completed file logs.
  • Even if the control signal is low when starting a model, a minimal file log will be created at T=0 when the real-time simulation starts. This is a current limitation and cannot be avoided.
.

3. Enabled Subsystems

To gain more granular control over file logging, you can place File Log blocks inside Enabled Subsystems or other conditional block execution mechanisms (such as For Iterator, Function-Call, or Triggered Subsystems). 
In contrast to the Start/Stop Recording API and Enable File Log blocks, Enabled Subsystems cannot be used to stop the logging service—the logging service runs continuously during the simulation. As a result of this:
  • No separate log files are created on the target for each recording run.
  • No new SDI runs are created for each recording
  • There is no indication on the target that the logging service has stopped.
However, the Enabled Subsystem approach is useful as an overlay for excluding certain signals from logging.

Più risposte (0)

Tag

Non è stata ancora inserito alcun tag.

Community Treasure Hunt

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

Start Hunting!

Translated by