Quantcast

Documentation Center

  • Trial Software
  • Product Updates

Contents

ssSetOutputPortDimensionInfo

Specify information about the dimensionality of an output port

Syntax

int_T ssSetOutputPortDimensionInfo(SimStruct *S, int_T port, const DimsInfo_T *dimsInfo)

Arguments

S

SimStruct representing an S-Function block.

port

Index of an output port.

dimsInfo

Structure of type DimsInfo_T that specifies the dimensionality of the signals emitted by port.

See ssSetInputPortDimensionInfo for a description of this structure.

Returns

1 if successful; otherwise, 0.

Description

Specifies the dimension information for port. Use this function in mdlInitializeSizes to initialize the output port dimension information. If you want the port to inherit its dimensionality from the block to which it is connected, specify DYNAMIC_DIMENSION as the dimsInfo for port. In this case, the S-function must provide mdlSetOutputPortDimensionInfo and mdlSetDefaultPortDimensionInfo methods to enable the signal dimensions to be set correctly during signal propagation.

Languages

C, C++

Example

The following example specifies that output port 0 emits 2-by-2 matrix signals.

DECL_AND_INIT_DIMSINFO(di);
int_T dims[2];

di.numDims = 2;
dims[0] = 2;
dims[1] = 2;
di.dims = dims;
di.width = 4;
ssSetOutputPortDimensionInfo(S,  0, &di);

See the S-function sfun_matadd.csfun_matadd.c used in sfcndemo_mataddsfcndemo_matadd for a complete example that uses this function.

Was this topic helpful?