Skip to Main Content Skip to Search
Product Documentation

Importing Data to Root-Level Input Ports

Root-Level Input Ports

You can import data from a workspace and apply it to a root-level:

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.

Enabling Data Import

To enable data import:

  1. Select the Configuration Parameters > Data Import/Export > Input parameter.

  2. Enter an external input specification in the adjacent edit box and click Apply.

    For details, see Input Data.

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.

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.

Forms of Input Data

The input data can take any of the following forms:

Input Expressions

In the Input box, specify one of the following expressions:

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

Importing Bus Data

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
  


Related Products & Applications

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