Writing S-Functions Previous page   Next Page
mdlSetInputPortDimensionInfo

Set the dimensions of the signals accepted by an input port

C Syntax

C Arguments

S
   SimStruct representing an S-Function block.

port
   Index of a port.

dimsInfo
   Instance of Simulink.MSFcnRunTimeBlock class representing the S-Function block.

See ssSetInputPortDimensionInfo for a description of this structure.

M Syntax

M Arguments

s
   Instance of Simulink.MSFcnRunTimeBlock class representing the S-Function block.

port
   Integer value specifying index of port to be set.

dims
   1-D array that specifies the signal dimensions supported by the port, e.g., [5] for a 5-element vector signal or [3 3] for a 3 x 3 matrix signal.

Description

Simulink calls this method during dimension propagation with candidate dimensions dimsInfo for port. If the proposed dimensions are acceptable, this method should go ahead and set the actual port dimensions, using ssSetInputPortDimensionInfo. If they are unacceptable, this method should generate an error via ssSetErrorStatus.

By default, Simulink calls this method only if it can fully determine the dimensionality of port from the port to which it is connected. If it cannot completely determine the dimensionality from port connectivity, it invokes mdlSetDefaultPortDimensionInfo. If an S-function can fully determine the port dimensionality from partial information, the function should set the option SS_OPTION_ALLOW_PARTIAL_DIMENSIONS_CALL in mdlInitializeSizes, using ssSetOptions. If this option is set, Simulink invokes mdlSetInputPortDimensionInfo even if it can only partially determine the dimensionality of the input port from connectivity.

Languages

C, C++, M

Example

See matlabroot/simulink/src/sfun_matadd.c for an example of how to use this function.

See Also

ssSetErrorStatus


Previous page  mdlSetInputPortDataType mdlSetInputPortFrameData Next page

© 1994-2005 The MathWorks, Inc.