| Contents | Index |

| On this page… |
|---|
Save complete SimState in final state |
The Data Import/Export pane allows you to import input signal and initial state data from a workspace and export output signal and state data to the MATLAB® workspace during simulation. This capability allows you to use standard or custom MATLAB functions to generate a simulated system's input signals and to graph, analyze, or otherwise postprocess the system's outputs.
Specify the data to load from a workspace before simulation begins.
Specify the data to save to the MATLAB workspace after simulation completes.
For more information on using this pane, see Importing and Exporting Simulation Data.
See the documentation of the sim command for some capabilities that are available only for programmatic simulation.
Loads input data from a workspace before the simulation begins.
Default: Off, [t,u]
Loads data from a workspace.
Specify a MATLAB expression for the data to be imported from a workspace. The Simulink software resolves symbols used in this specification as described in Resolving Symbols.
See Importing Data to Root-Level Input Ports for information on how to use this field.
Does not load data from a workspace.
You must select the Input check box before entering input data.
Simulink software linearly interpolates or extrapolates input values as necessary if the Interpolate data option is selected for the corresponding Inport.
The use of the Input box is independent of the setting of the Format list on the Data Import/Export pane.
| Parameter: LoadExternalInput |
| Type: string |
| Value: 'on' | 'off' |
| Default: 'off' |
| Parameter: ExternalInput |
| Type: scalar or vector |
| Value: any valid value |
| Default: [t,u] |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | No impact |
| Safety precaution | No impact for simulation and during development Off for production code generation |
Loads the model's initial states from a workspace before simulation begins.
Default: Off, xInitial
Simulink software loads initial states from a workspace.
Specify the name of a variable that contains the initial state values, for example, a variable containing states saved from a previous simulation.
Use the structure or structure-with-time option to specify initial states if you want to accomplish any of the following:
Associate initial state values directly with the full path name to the states. This eliminates errors that could occur if Simulink software reorders the states, but the initial state array is not correspondingly reordered.
Assign a different data type to each state's initial value.
Initialize only a subset of the states.
See Importing and Exporting States for more information.
Simulink software does not load initial states from a workspace.
You must select the Initial State check box before entering initial state data.
The initial values that the workspace variable specifies override the initial values that the model specifies (the values that the initial condition parameters of those blocks in the model that have states specify).
Use either the structure format or structure-with-time format to initialize the states of a top model and the models that it references.
| Parameter: LoadInitialState |
| Type: string |
| Value: 'on' | 'off' |
| Default: 'off' |
| Parameter: InitialState |
| Type: variable (string) or vector |
| Value: any valid value |
| Default: 'xInitial' |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | No impact |
| Safety precaution | No impact for simulation and during development Off for production code generation |
Saves simulation time data to the specified variable during simulation.
Default: On, tout
Simulink software exports time data to the MATLAB workspace during simulation.
Specify the name of the MATLAB variable used to store time data. See Exporting Simulation Data for more information.
Simulink software does not export time data to the MATLAB workspace during simulation.
You must select the Time check box before entering the time variable.
Simulink software saves the output to the MATLAB workspace at the base sample rate of the model. Use a To Workspace block if you want to save output at a different sample rate.
The Time, State, Output area includes parameters for specifying a limit on the number of data points to export and the decimation factor.
| Parameter: SaveTime |
| Type: string |
| Value: 'on' | 'off' |
| Default: 'on' |
| Parameter: TimeSaveName |
| Type: string |
| Value: any valid value |
| Default: 'tout' |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | No impact |
| Safety precaution | No impact for simulation and during development Off for production code generation |
Saves state data to the specified MATLAB variable during a simulation.
Default: Off, xout
Simulink software exports state data to the MATLAB workspace during simulation.
Specify the name of the MATLAB variable used to store state data. See Importing and Exporting States for more information.
Simulink does not export state data during simulation.
You must select the States check box before entering the states variable.
Simulink saves the states in a MATLAB workspace variable having the specified name.
The saved data has the format that you specify with the Format parameter.
If you select the States check box, Simulink does not log fixed-point states.
Simulink creates empty variables for state logging (xout) if both of these conditions apply:
You enable States.
A model has no states.
See Importing and Exporting States for more information.
| Parameter: SaveState |
| Type: string |
| Value: 'on' | 'off' |
| Default: 'off' |
| Parameter: StateSaveName |
| Type: string |
| Value: any valid value |
| Default: 'xout' |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | No impact |
| Safety precaution | No impact for simulation and during development Off for production code generation |
Saves signal data to the specified MATLAB variable during simulation.
Default: On, yout
Simulink software exports signal data to the MATLAB workspace during simulation.
Specify the name of the MATLAB variable used to store signal data. See Exporting Simulation Data for more information.
Simulink software does not export signal data during simulation.
You must select the Output check box before entering the output variable.
Simulink software saves the output to the MATLAB workspace at the base sample rate of the model. Use a To Workspace block if you want to save output at a different sample rate.
The Time, State, Output area includes parameters for specifying the format and other characteristics of the saved data (for example, the format for the saved data and the decimation factor).
If you select the Output check box, Simulink logs fixed-point data as double.
| Parameter: SaveOutput |
| Type: string |
| Value: 'on' | 'off' |
| Default: 'on' |
| Parameter: OutputSaveName |
| Type: string |
| Value: any valid value |
| Default: 'yout' |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | No impact |
| Safety precaution | No impact for simulation and during development Off for production code generation |
Saves the logged states of the model at the end of a simulation to the specified MATLAB variable.
Default: Off, xFinal
Simulink software exports final logged state data to the MATLAB workspace during simulation.
Specify the name of the MATLAB variable in which to store the values of these final states. See Importing and Exporting States for more information.
Simulink software does not export the final state data during simulation.
You must select the Final states check box before entering the final states variable.
Simulink software saves the final states in a MATLAB workspace variable having the specified name.
The saved data has the format that you specify with the Format parameter.
Simulink creates empty variables for final state logging (xfinal) if both of these conditions apply:
You enable Final states.
A model has no states.
See Importing and Exporting States for more information.
| Parameter: SaveFinalState |
| Type: string |
| Value: 'on' | 'off' |
| Default: 'off' |
| Parameter: FinalStateName |
| Type: string |
| Value: any valid value |
| Default: 'xFinal' |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | No impact |
| Safety precaution | No impact for simulation and during development Off for production code generation |
Select the data format for saving states, output, and final states data.
Default: Array
The format of the data is a matrix each row of which corresponds to a simulation time step.
For logging output, the format of the data is a structure that contains substructures for each port. Each port substructure contains signal data for the corresponding port. For logging states, the structure contains a substructure for each block that has a state.
The format of the data is a structure that has two fields: a time field and a signals field. The time field contains a vector of simulation times. The signals field contains same data as for the Structure format.
You can use array format to save your model's outputs and states only if the outputs are either all scalars or all vectors (or all matrices for states), are either all real or all complex, and are all of the same data type. Use the Structure or Structure with time output formats (see Structure with time) if your model's outputs and states do not meet these conditions.
If you enable the Save complete SimState in final state parameter, then the format does not apply to final states data.
Simulink software can read back simulation data saved to the workspace in the Structure with time output format. See Importing Data Structures to a Root-Level Input Port for more information.
To specify the format for signal logging data, use the Signal logging format parameter.
| Parameter: SaveFormat |
| Type: string |
| Value: 'Array' | 'Structure' | 'StructureWithTime' |
| Default: 'Array' |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | No impact |
| Safety precaution | No impact for simulation and during development Off for production code generation |
Limit the number of data points to export to the MATLAB workspace.
Default: On, 1000
Limits the number of data points exported to the MATLAB workspace to the number that you specify.
Specify the maximum number of data points to export to the MATLAB workspace. At the end of the simulation, the MATLAB workspace contains the last N points generated by the simulation.
Does not limit the number of data points.
You must select the Limit data points to last check box before specifying the number of data points.
Saving data to the MATLAB workspace can slow down the simulation and consume memory. Use this parameter to limit the number of samples saved to help avoid this problem.
You can also apply a Decimation factor to skip a selected number of samples.
| Parameter: LimitDataPoints |
| Type: string |
| Value: 'on' | 'off' |
| Default: 'on' |
| Parameter: MaxDataPoints |
| Type: string |
| Value: any valid value |
| Default: '1000' |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | No impact |
| Safety precaution | No impact for simulation and during development Off for production code generation |
Specify that Simulink software output only every N points, where N is the specified decimation factor.
Default: 1
The default value (1) specifies that all data points are saved.
Simulink software outputs data only at the specified number of data points. For example, specifying 2 saves every other data point, while specifying 10 saves just one in ten data points.
At the end of the simulation, the total number of data points is reduced by the factor specified.
Saving data to the MATLAB workspace can slow down the simulation and consume memory. Use this parameter to limit the number of samples saved to help avoid this problem.
You can also use the Limit data points to last parameter to help resolve this problem.
| Parameter: Decimation |
| Type: string |
| Value: any valid value |
| Default: '1' |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | No impact |
| Safety precaution | No impact for simulation and during development Off for production code generation |
At the end of a simulation, Simulink saves the complete set of states of the model, including logged states, to the specified MATLAB variable.
Default: Off, xFinal
Simulink software exports the complete set of final state data (i.e., the SimState) to the MATLAB workspace during simulation.
Specify the name of the MATLAB variable in which to store the values of the final states. See Importing and Exporting States for more information.
Simulink software exports the final logged states during simulation.
You must select the Final states check box to enable the Save complete SimState in final state option.
Simulink saves the final states in a MATLAB workspace variable having the specified name.
This parameter is enabled by Final states.
| Parameter: SaveCompleteFinalSimState |
| Type: string |
| Value: 'on' | 'off' |
| Default: 'off' |
| Parameter: FinalStateName |
| Type: string |
| Value: any valid value |
| Default: 'xFinal' |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | No impact |
| Safety precaution | No impact |
Globally enable or disable signal logging for this model.
Default: On, logsout
Enables signal logging to the MATLAB workspace during simulation.
Specify the name of the signal logging object used to record logged signal data in the MATLAB workspace. For more information, see Exporting Signal Data Using Signal Logging.
Disables signal logging to the MATLAB workspace during simulation.
You must select the Signal logging check box before entering the signal logging variable.
Simulink saves the signal data in a MATLAB workspace variable having the specified name.
The saved data has the format that you specify with the Signal logging format parameter.
Simulink does not support signal logging for the following types of signals:
Output of a Function-Call Generator block
Signal connected to the input of a Merge block
Outputs of Trigger and Enable blocks
If you select Signal logging, you can use the Configure Signals to Log button to open the Signal Logging Selector. You can use the Signal Logging Selector to:
Review all signals in a model hierarchy that are configured for logging
Override signal logging settings for specific signals
Control signal logging throughout a model reference hierarchy in a more streamlined way than in previous releases
You can use the Signal Logging Selector with Simulink and Stateflow® signals.
For details about the Signal Logging Selector, see Using the Signal Logging Selector to View the Signal Logging Configuration and Overriding Signal Logging Settings.
This parameter enables:
Record and inspect simulation output
Signal logging format
The Configure Signals to Log button
| Parameter: SignalLogging |
| Type: string |
| Value: 'on' | 'off' |
| Default: 'on' |
| Parameter: SignalLoggingName |
| Type: string |
| Value: any valid value |
| Default: 'logsout' |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | No impact |
| Safety precaution | No impact for simulation or during development Off for production code generation |
Specify format for signal logging data for this model.
Default: ModelDataLogs
Simulink uses a Simulink.ModelDataLogs object to store the logged signal data. Simulink.Timeseries and Simulink.TsArray objects provide the format for the data.
Simulink uses a Simulink.SimulationData.Dataset object to store the logged signal data and MATLAB timeseries objects for formatting the data.
You must select Signal logging before specifying the signal logging format.
The Dataset format:
Uses MATLAB timeseries objects to store logged data (rather than Simulink.Timeseries and Simulink.TsArray objects). MATLAB timeseries objects allow you to work with logging data in MATLAB without a Simulink license.
Supports logging multiple data values for a given time step, which can be important for Iterator subsystem and Stateflow signal logging
Provides an easy to analyze format for logged signal data for models with deep hierarchies, bus signals, and signals with duplicate or invalid names
Avoids the limitations of the ModelDataLogs format. For example, for a virtual bus, logging only logs one of multiple signals that share the same source block. SeeBug Report 495436 for a description of the ModelDataLogs limitations.
If you have logged signal data in the ModelDataLogs format, you can use the Simulink.ModelDataLogs.convertToDataset function to convert the ModelDataLogs data to Dataset format.
Simulink checks signal logging data format consistency for certain model referencing configurations. For details, see Model Reference Signal Logging Format Consistency. One approach for handling reported inconsistencies is to use the Simulink.SimulationData.updateDatasetFormatLogging function to update the whole model to use Dataset format. This approach avoids you having to set the Configuration Parameters > Data Import/Export > Signal logging format parameter individually for each referenced model and each variant. However, the update can cause changes to the model hierarchy.
Simulink uses the Simulink.SimulationData.Dataset data format for logging data stores.
If you have logged signal data in the ModelDataLogs format, you can use the Simulink.ModelDataLogs.convertToDataset function to convert the ModelDataLogs data to Dataset format.
For additional information about specifying the signal logging format, see Specifying the Signal Logging Data Format.
| Parameter: SignalLoggingSaveFormat |
| Type: string |
| Value: 'ModelDataLogs' | 'Dataset' |
| Default: 'ModelDataLogs' |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | No impact |
| Safety precaution | No impact for simulation and during development Off for production code generation |
Globally enable or disable logging of Data Store Memory block variables for this model.
Default: On, dsmsout
Enables data store logging to the MATLAB workspace during simulation.
Specify the name of the data store logging object to use for recording logged data store data. The data store logging object must be in the MATLAB workspace.
Disables data store logging to the MATLAB workspace during simulation.
Simulink saves the data in a MATLAB workspace variable having the specified name.
The saved data has the Simulink.SimulationData.Dataset format.
See Supported Data Types, Dimensions, and Complexity for Logging Data Stores and Data Store Logging Limitations.
Dependencies. Select the Data stores check box before entering the data store logging variable.
| Parameter: DSMLogging |
| Type: string |
| Value: 'on' | 'off' |
| Default: 'on' |
| Parameter: DSMLoggingName |
| Type: string |
| Value: any valid value |
| Default: 'dsmOut' |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | No impact |
| Safety precaution | No impact for simulation and during development Off for production code generation |
Select options for generating additional output signal data for variable-step solvers.
Default: Refine output
Generates data output between as well as at simulation times steps. Use Refine factor to specify the number of points to generate between simulation time steps. For more information, see Refining Output.
Generates additional output at specified times. Use Output times to specify the simulation times at which Simulink software should generate additional output.
Generates output only at specified times. Use Output times to specify the simulation times at which Simulink software should generate output.
These settings can force the solver to calculate output values for times that it would otherwise have omitted because the calculations were not needed to achieve accurate simulation results. These extra calculations can cause the solver to locate zero crossings that it would otherwise have missed.
For additional information on how Simulink software calculates outputs for these three options, see Specifying Which Samples to Export for Models with Variable-Step Solvers.
This parameter is enabled only if the model specifies a variable-step solver (see Solver Type).
Selecting Refine output enables the Refine factor parameter.
Selecting Produce additional output or Produce specified output only enables the Output times parameter.
| Parameter: OutputOption |
| Type: string |
| Value: 'RefineOutputTimes' | 'AdditionalOutputTimes' | 'SpecifiedOutputTimes' |
| Default: 'RefineOutputTimes' |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | No impact |
| Safety precaution | No impact for simulation and during development Off for production code generation |
Specify how many points to generate between time steps to refine the output.
Default: 1
The default refine factor is 1, meaning that no extra data points are generated.
A refine factor of 2 provides output midway between the time steps, as well as at the steps.
Simulink software ignores this option for discrete models. This is because the value of data between time steps is undefined for discrete models.
This parameter is enabled only if you select Refine output as the value of Output options.
| Parameter: Refine |
| Type: string |
| Value: any valid value |
| Default: '1' |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | No impact |
| Safety precaution | No impact for simulation and during development Off for production code generation |
Specify times at which Simulink software should generate output in addition to, or instead of, the times of the simulation steps taken by the solver used to simulate the model.
Default: []
Enter a matrix containing the times at which Simulink software should generate output in addition to, or instead of, the simulation steps taken by the solver.
If the value of Output options is Produce additional output, the default value [] specifies that no additional data points are generated.
If the value of Output options is Produce specified output only, the default value [] specifies that no data points are generated.
The Produce additional output option generates output at the specified times as well as the regular simulation steps.
The Produce specified output only option generates output only at the specified times.
Discrete models define outputs only at major time steps. Therefore, Simulink software logs output for discrete models only at major time steps. If the Output times field specifies other times, Simulink software displays a warning at the MATLAB command line.
This parameter is enabled only if the value of Output options is Produce additional output or Produce specified output only.
| Parameter: OutputTimes |
| Type: string |
| Value: any valid value |
| Default: '[]' |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | No impact |
| Safety precaution | No impact for simulation and during development Off for production code generation |
Enable the single-output format of the sim command.
Default: off
Turning this option 'on' causes Simulink to return all simulation outputs within a single Simulink.SimulationOutput object, providing that you simulate by choosing Simulation > Start from the model window.
Enabling this option makes the sim command compatible with the parfor command, in terms of transparency issues.
If you select this option and you simulate by entering the sim command at the command line of the MATLAB command window, then the output variables will not be stored in the object 'out'. Instead, they will be stored in their respective variable names. This design is necessary to avoid workspace issues when sim is called from within a parfor loop.
The method who of the Simulink.SimulationOutput object returns the list of variables that the object contains.
Use the get method of the Simulink.SimulationOutput object to access the variables that the object contains.
| Parameter: ReturnWorkspaceOutputs |
| Type: string |
| Value: 'on' | 'off' | |
| Default: 'off' |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | No impact |
| Safety precaution | No impact |
Specify whether Simulink software displays logged signals in the Simulation Data Inspector at the end of a simulation or whenever you pause the simulation.
Default: Off
Simulink displays logged signals in the Simulation Data Inspector at the end of a simulation or whenever you pause the simulation.
Simulink does not display logged signals at the end of a simulation.
If this option is off, in the Model Editor you can select Tools > Inspect Logged Signals to open the Simulation Data Inspector.
This parameter is enabled by Signal logging.
| Parameter: InspectSignalLogs |
| Type: string |
| Value: 'on' | 'off' |
| Default: 'off' |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | No impact |
| Safety precaution | No impact for simulation and during development Off for production code generation |
![]() | Solver Pane | Optimization Pane: General | ![]() |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |