| Simulink® | ![]() |

| On this page… |
|---|
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. The input data can take any of the following forms:
Time series
Data array
Time expression
Data structure
See Importing Data from a Workspace 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 specified by the workspace variable override the initial values specified by the model itself (the values specified by the initial condition parameters of those blocks in the model that have states).
You must use the structure 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 Data to the MATLAB Workspace 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 Save options area enables you to specify the format and restrict the amount of output saved.
| 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 software does not export state data during simulation.
You must select the States check box before entering the states variable.
Simulink software saves the states in a MATLAB workspace variable having the specified name.
The saved data has the format that you specify in the Save options area.
| 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 Data to the MATLAB Workspace 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 Save options area enables you to specify the format and restrict the amount of output saved.
| 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 model's states at the end of a simulation to the specified MATLAB variable.
Default: Off, xFinal
Simulink software exports final state data to the MATLAB workspace during simulation.
Specify the name of the MATLAB variable used to store the values of the final states. See Importing and Exporting States for more information.
Simulink software does not export 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 in the Save options area.
| 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 |
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. See Logging Signals for more information.
Disables signal logging to the MATLAB workspace during simulation.
You must select the Signal logging check box before entering the signal logging variable.
Simulink software saves the signal data in a MATLAB workspace variable having the specified name.
The saved data has the format that you specify in the Save options area.
Simulink software 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
This parameter enables Inspect signal logs when simulation is paused/stopped.
| 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 and during development Off for production code generation |
Specify whether Simulink software displays logged signals in the MATLAB Time Series Tools viewer at the end of a simulation or whenever you pause the simulation.
Default: Off
Simulink software displays logged signals in the MATLAB Time Series Tools viewer at the end of a simulation or whenever you pause the simulation.
Simulink software does not display logged signals at the end of a simulation.
If this option is off, you must select Tools > Inspect logged signals in the model editor to display logged signals in the Time Series Tools viewer.
You must run the simulation before selecting Tools > Inspect logged signals. Otherwise, the command has no effect.
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 |
Specify the number of data points exported to the MATLAB workspace be limited to the number specified.
Default: On, 1000
Limits the number of data points exported to the MATLAB workspace to the number specified.
Specify the maximum number of data points exported 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 |
Select the format of state and output data saved to the MATLAB workspace.
Default: Array
The format of the data is a matrix each row of which corresponds to a simulation time step.
The format of the data is a structure that contains substructures for each port. Each port substructure contains signal data for the corresponding port.
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 a substructure for each model input port (for imported data) or output port (for exported data). Each port substructure contains signal data for the corresponding port.
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.
Simulink software can read back simulation data saved to the workspace in the Structure with time output format. See Importing Signal-and-Time Data Structures for more information.
| 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 |
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 this field 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 this field to specify the simulation times at which Simulink software should generate additional output.
Generates output only at specified times. Use this field to specify the simulation times at which Simulink software should generate output.
These settings can help the solver locate zero crossings. In particular, it helps reduce the chance of missing a zero crossing. It does not help locate the missed zero crossings.
For additional information on how Simulink software calculates outputs for these three options, see Specifying Output Options.
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 the times at which Simulink software should generate output in addition to or instead of at 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 additional output.
The default refine factor [ ], indicates that no extra 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 you select Produce additional output or Produce specified output only as the value of Output options.
| 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 |
![]() | Solver Pane | Optimization Pane | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |