Contents

PostPropagationSetup

Specify the sizes of the work vectors and create the run-time parameters required by this MATLAB S-function

Required

No

Language

MATLAB

Syntax

PostPropagationSetup(s)

Arguments

s

Instance of Simulink.MSFcnRunTimeBlock class representing the Level-2 MATLAB S-Function block.

Description

The Simulink® engine calls this optional method to enable this S-function to set the sizes of state and work vectors that it needs to store global data and to create run-time parameters (see Run-Time Parameters). The engine invokes this method after it has determined the input port width, output port width, and sample times of the S-function. This allows the S-function to size the state and work vectors based on the number and sizes of inputs and outputs and/or the number of sample times.

A Level-2 MATLAB S-function must implement this method if any DWork vectors are used in the S-function. In the case of MATLAB S-functions, this method sets the number of DWork vectors and initializes their attributes. For example, the following code in the PostPropagationSetup method specifies the usage for the first DWork vector:

s.DWork(1).Usage = type;

where s is an instance of the Simulink.MSFcnRunTimeBlock class representing the Level-2 MATLAB S-Function block and type is one of the following:

  • DWork

  • DState

  • Scratch

  • Mode

Example

For a full example of a Level-2 MATLAB S-function using DWork vectors, see the file adapt_lms.madapt_lms.m used in the Simulink model sldemo_msfcn_lmssldemo_msfcn_lms.

Was this topic helpful?