Specify MAT-file logging
Category: Code Generation > Interface
Default: on for the GRT target, off for ERT-based targets
Enable MAT-file logging. When you select this option, the generated code saves to MAT-files simulation data specified in one of the following ways:
Configuration Parameters > Data Import/Export (see Model Configuration Parameters: Data Import/Export)
To Workspace blocks
To File blocks
Scope blocks with the Log data to workspace parameter enabled
In simulation, this data would be written to the MATLAB® workspace, as described in Export Simulation Data
and Configure Signal Data for Logging. Setting MAT-file logging
redirects the data to a MAT-file instead. The file is named
, where
model
.mat
is the name
of your model. model
Disable MAT-file logging. Clearing this option has the following benefits:
Eliminates overhead associated with supporting a file system, which typically is not a requirement for embedded applications
Eliminates extra code and memory usage required to initialize, update, and clean up logging variables
Under certain conditions, eliminates code and storage associated with root output ports
Omits the comparison between the current time and stop time in
the
,
allowing the generated program to run indefinitely, regardless
of the stop time settingmodel
_step
When you select MAT-file logging, you must also select the configuration parameters Support: non-finite numbers and, if you use an ERT-based system target file, Support: floating-point numbers.
Selecting this option enables MAT-file variable name modifier.
For ERT-based system target files, clear this parameter if you are using exported function calls.
The code generator does not support MAT-file logging for custom data types (data types that are not built into Simulink®).
MAT-file logging does not support file-scoped data, for example, data
items to which you apply the built-in storage class
FileScope
.
In a referenced model, only the following data logging features are supported:
To File blocks
State logging — the software stores the data in the MAT-file for the top model.
In the context of the Embedded Coder® product, MAT-file logging does not support the following IDEs: Analog Devices® VisualDSP++®, Texas Instruments™ Code Composer Studio™, Wind River® DIAB/GCC.
MAT-file logging does not support Outport blocks to which
you apply the storage class ImportedExternPointer
or
storage classes that yield nonaddressable data in the generated code. For
example, the storage class GetSet
causes the
Outport to appear in the generated code as a function
call, which is not addressable. This limitation applies whether you apply
the storage class directly by using, for example, the Model Data
Editor, or by resolving the Outport to a
Simulink.Signal
object that uses the
storage class. As a workaround, apply the storage class to the signal that
enters the Outport block.
Parameter:
MatFileLogging |
Type: character vector |
Value:
'on' | 'off' |
Default:
'on' for the GRT target, 'off' for
ERT-based targets |
Application | Setting |
---|---|
Debugging | On |
Traceability | No impact |
Efficiency | Off |
Safety precaution | Off |