Skip to Main Content Skip to Search
Product Documentation

Importing Data Arrays to a Root-Level Input Port

Data Array Format

This import format consists of a real (noncomplex) matrix of data type double. The first column of the matrix must be a vector of times in ascending order. The remaining columns specify input values. In particular, each column represents the input for a different Inport or Trigger block signal (in sequential order) and each row is the input value for the corresponding time point. For a Trigger block, the signal driving the trigger port must be the last data item.

The total number of columns of the input matrix must equal n + 1, where n is the total number of signals entering the model's input ports.

Specifying the Input Expression

The default input expression for a model is [t,u] and the default input format is Array. So if you define t and u in the MATLAB workspace, you need only select the Input option to input data from the model workspace. For example, suppose that a model has two input ports, In1 that accepts two signals, and In2 that accepts one signal. Also, suppose that the MATLAB workspace defines t and u as follows:

N = 10;
Ts = 0.1
t = (0:N)* Ts';
u = [sin(t), cos(t), 4*cos(t)];

When the simulation runs, the signals sin(t) and cos(t) will be assigned to In1 and the signal 4*cos(t) will be assigned to In2.

  


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