Quantcast

Documentation Center

  • Trial Software
  • Product Updates

Generating Input Signals for Simulink Model Inports

This example shows a simple Simulink model with three inports to illustrate the different methods for applying signals to those inports.

Model Overview

The Simulink model used for this example sums the inputs and sends the resulting value to the outport.

systemtestinputdemo

Applying Simulink Inputs by Indexing Through a Matrix

The first test illustrates how to create and apply input signals to a Simulink model by indexing through a matrix of signals.

In Pre Test, the signal matrix is created to define the input signals to be used for the test.

The Test Vector, Index, is then used to index through the signal matrix to initialize the Test Variable, InputSignal, on each iteration through the Main Test.

Use the systemtest function to open the test.

systemtest('SimulinkInputDemo1.test')

Open the test in the SystemTest desktop.Open the test in the SystemTest desktop.

Applying Simulink Inputs by Indexing Through a Cell Array

The second test illustrates how to create and apply input signals to a Simulink model by indexing through a cell array of signals.

This method is more general than indexing through a matrix of signals since the cell array can use Simulink structures as inputs, as illustrated by the third signal in the 'Create signal' element.

In Pre Test, the signal matrix is created to define the input signals to be used for the test.

The Test Vector, Index, is then used to index through the signal cell array to initialize the Test Variable, InputSignal, on each iteration through the Main Test.

Use the systemtest function to open the test.

systemtest('SimulinkInputDemo2.test')

Open the test in the SystemTest desktop.Open the test in the SystemTest desktop.

Applying Simulink Inputs from MAT-file Data

The third test illustrates how to apply input signals from a series of MAT files to a Simulink model.

A MAT-file Test Vector contains the MAT-file names and supplies the data from a MAT-file in each iteration of the Main Test.

Use the systemtest function to open the test.

systemtest('SimulinkInputDemo3.test')

Open the test in the SystemTest desktop.Open the test in the SystemTest desktop.

Was this topic helpful?