ssSetInputPortDimensionInfo - Specify information about the dimensionality of an input

            port - MATLAB ([original](https://www.mathworks.com/help/simulink/sfg/sssetinputportdimensioninfo.html)) ([raw](?raw))

Specify information about the dimensionality of an input port

Syntax

int_T ssSetInputPortDimensionInfo(SimStruct *S, int_T port, DimsInfo_T *dimsInfo)

Arguments

S

SimStruct that represents an S-Function block.

port

Index of an input port.

dimsInfo

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

The structure is defined as

typedef struct DimsInfo_tag{ int width; /* number of elements / int numDims / Number of dimensions */ int dims; / Dimensions. */ [snip] }DimsInfo_T;

where

Returns

1 if successful; otherwise, 0.

Description

Specifies the dimension information for port. Use this function in mdlInitializeSizes to initialize the input port dimension information. If you want the port to inherit its dimensions from the port to which it is connected, specify DYNAMIC_DIMENSION as thedimsInfo for port. In this case, the S-function must provide mdlSetInputPortDimensionInfo andmdlSetDefaultPortDimensionInfo methods to enable the signal dimensions to be set correctly during signal propagation.

Examples

The following example specifies that input port 0 accepts 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;
ssSetInputPortDimensionInfo(S, 0, &di);

}

See the S-function [sfun_matadd.c](https://mdsite.deno.dev/matlab:sfunddg%5Fcb%5Fedit%28'sfun%5Fmatadd'%29;) used in [sfcndemo_matadd](https://mdsite.deno.dev/matlab:open%5Fsystem%28[matlabroot,'/toolbox/simulink/sfuntemplates/sfcndemo%5Fmatadd']%29;) and the S-function [sdotproduct.c](https://mdsite.deno.dev/matlab:sfunddg%5Fcb%5Fedit%28'sdotproduct'%29;) used in [sfcndemo_sdotproduct](https://mdsite.deno.dev/matlab:open%5Fsystem%28[matlabroot,'/toolbox/simulink/sfuntemplates/sfcndemo%5Fsdotproduct']%29;) for complete examples that use this function.

Version History

Introduced before R2006a