Configure Model to Log Signals on SD Card
You need to enable the settings required for MAT-file logging by following these steps:
In the Simulink window, go to Modeling > Model Settings to open the Configuration Parameters dialog box.
In the Code Generation pane, go to Interface > Advanced Parameters, and select MAT-file logging.
SD card logging is supported in models containing To Workspace (Simulink) block. You must specify the values for several block parameters in the To Workspace block, as described in this section.
To configure a Simulink® model to run on the target hardware, perform these steps:
On the Modeling tab, in the Simulate section, set the Stop Time. The signals are logged for the time period specified in the Stop Time parameter. The default value is
Inf
. Enter time in seconds to log signals for that time period.In the Simulink model, set the parameter values of To Workspace blocks.
Settings for To Workspace Block
Double-click the To Workspace (Simulink) block, and specify these parameters in the Block Parameter dialog box.
Parameter | Description |
---|---|
Variable name | Specify a variable name for the logged data. |
Limit data points to last | You can use the default value for this parameter. Note Before you simulate the model, you need to run the
|
Decimation | Use this parameter for the block to write data points
at every nth sample, where
n is the decimation factor. The
default decimation, For example, if you specify
Decimation as |
Save format | Select a format of the variable to which you save data.
SD card logging supports only these three formats:
Note Select Save format as
|
Sample time (–1 for inherited) | Specify an interval at which the block reads data. When
you specify this parameter as |