| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Simulink |
| Contents | Index |
| Learn more about Simulink |
int_T ssSetInputPortDimensionInfo(SimStruct *S, int_T port, DimsInfo_T *dimsInfo)
SimStruct representing an S-Function block.
Index of an input port.
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
numDims specifies the number of dimensions of the signal, e.g., 1 for a 1-D (vector) signal or 2 for a 2-D (matrix) signal, or DYNAMICALLY_SIZED if the number of dimensions is determined dynamically.
dims is an integer array that specifies the size of each dimension, e.g., [2 3] for a 2-by-3 matrix signal, or DYNAMICALLY_SIZED for each dimension that is determined dynamically, e.g., [2 DYNAMICALLY_SIZED].
width equals the total number of elements in the signal, e.g., 12 for a 3-by-4 matrix signal or 8 for an 8-element vector signal, or DYNAMICALLY_SIZED if the total number of elements is determined dynamically.
1 if successful; otherwise, 0.
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 the dimsInfo for port. In this case, the S-function must provide mdlSetInputPortDimensionInfo and mdlSetDefaultPortDimensionInfo methods to enable the signal dimensions to be set correctly during signal propagation.
C, C++
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 matlabroot/toolbox/simulink/simdemos/simfeatures/src/sfun_matadd.c used in sfcndemo_matadd.mdl and the S-function matlabroot/toolbox/simulink/simdemos/simfeatures/src/sdotproduct.c used in sfcndemo_sdotproduct.mdl for complete examples that use this function.
ssSetInputPortMatrixDimensions, ssSetInputPortVectorDimension
![]() | ssSetInputPortDataType | ssSetInputPortDimensionsMode | ![]() |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |