Documentation

ssGetInputPortSignal

Get the address of a contiguous signal entering an input port

Syntax

const void *ssGetInputPortSignal(SimStruct *S, int_T inputPortIdx)

Arguments

S

SimStruct representing an S-Function block.

inputPortIdx

Index of the port whose address is required.

Returns

A pointer (void *) to the input port specified by the indexinputPortIdx.

Description

Use to get the address of a contiguous signal entering an input port. Your S-function should use this macro only ifmdlInitializeSizeshas specified that the elements of the input signal be contiguous, usingssSetInputPortRequiredContiguous. For noncontiguous input, use thessGetInputPortSignalPtrsfunction.

Note

If you have specified that the input ports are reusable usingssSetInputPortOptimOpts, then you cannot usessGetInputPortSignalanywhere except inmdlOutputs. For example, if the inputs have been specified as reusable with theSS_REUSABLE_AND_LOCALflag, themdlUpdateroutine errors out because it tries to access input memory that is unavailable.

Note

ThessGetInputPortSignal宏成为一个功能当你编译自动送料unction in debug mode (mex -g).

Languages

C, C++

Example

The following code demonstrates the use ofssGetInputPortSignal.

nInputPorts = ssGetNumInputPorts(S); for (i = 0; i < nInputPorts; i++) { int_T nu = ssGetInputPortWidth(S,i); if ( ssGetInputPortRequiredContiguous(S,i) ) { const void *u = ssGetInputPortSignal(S,i); UseInputVectorInSomeFunction(u, nu); } else { InputPtrsType u = ssGetInputPortSignalPtrs(S,i); for (j = 0; j < nu; j++) { UseInputInSomeFunction(*u[j]); } } }

If you know that the inputs are alwaysreal_Tsignals, thessGetInputPortSignalline in the above code snippet would be

const real_T *u = ssGetInputPortRealSignal(S,i);

Introduced before R2006a