| Contents | Index |
| On this page… |
|---|
You can import data from a workspace and apply it to a root-level:
Enable block
Inport block
Trigger block that has an edge-based (rising, falling, or either) trigger type
You can also import data from a workspace and apply it to a From Workspace block. For details, see the From Workspace documentation and Importing Data to Create an Input Test Case.
To enable data import:
Select the Configuration Parameters > Data Import/Export > Input parameter.
Enter an external input specification in the adjacent edit box and click Apply.
For details, see Input Data.
Use the Configuration Parameters > > Input parameter to import data from a workspace and apply it to the root-level input ports of a model during a simulation run.
Simulink linearly interpolates or extrapolates input values as necessary if you select the Interpolate data option for the corresponding Inport or Trigger block.
Note The use of the Input box is independent of the setting of the Format list on the Data Import/Export pane. |
Simulink resolves symbols used in the external input specification as described in Resolving Symbols. See the documentation of the sim command for some data import capabilities that are available only for programmatic simulation.
The input data can take any of the following forms:
MATLAB timeseries — For details, see the following sections:
Array — See Importing Data Arrays to a Root-Level Input Port.
Simulink.SimulationData.Signal — For details, see Importing Signal Logging Data
Structure — See Importing Data Structures to a Root-Level Input Port.
Empty matrix — Use an empty matrix for ports for which you want to use ground values, without having to create data structures.
Time expression — See Importing MATLAB Time Expression Data.
Simulnk.Timeseries and Simulink.TsArray — See Importing Simulink.Timeseries and Simulink.TsArray Data to a Root-Level Input Port.
In the Input box, specify one of the following expressions:
A MATLAB function (expressed as a string) that specifies the input u = UT(t) at each simulation time step
A table of input values versus time for all input ports UT = [T, U1, ... Un], where T = [t1, ..., tm]'
A structure array containing data for all input ports
A comma-separated list of tables. For details, see Comma-Separated Lists for the Input Parameter
Comma-Separated Lists for the Input Parameter. Each table corresponds to a specific input port. Each variable or expression in the list should evaluate to the appropriate object that corresponds to one of the root-level input ports of the model, with the first item corresponding to the first root-level input port, the second to the second root-level input port, and so on.
For an Enable or Trigger block, the signal driving the enable or trigger port must be the last item in the comma-separated list. If you have both an enable and a trigger port, then specify the enable port as the next-to-last item in the list, and the trigger port as the last item.
You can load data for a subset of root-level Inport ports, without having to create data structures for the ports for which you want to use ground values. For information about ground values, see Initializing Signals and Discrete States.
Using partial specification of ports simplifies the specification of external data to input. You can use partial specification to omit an array of buses signal from the external data to input (you cannot load array of buses data into a root-level Inport block).
Use an empty matrix to specify ground values for a port. For example, to load data for input ports in1 and in3, and to use ground values for port in2, enter the following in the Input parameter:
in1, [], in3
To import bus data to root input ports, use a structure of MATLAB timeseries objects. For details, see Importing Structures of MATLAB timeseries Objects for Bus Signals to a Root-Level Input Port.
To import an array of buses from a port, you can specify an empty matrix for that port in a comma-separated list of tables. The empty matrix uses the ground values for the bus signal.
For example, to load data for input ports in1 and in3, and to use ground values for port in2, enter the following in the Input parameter:
in1, [], in3
![]() | Importing Signal Logging Data | Importing MATLAB timeseries Data | ![]() |

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 |