Main Content

Configure C/C++ S-Function Features

Configure block functionality for C/C++ S-functions

C/C++ S-functions allow you to configure extended block functionality through various callback and SimStruct methods.

  • Create and configure input/output ports.

  • Specify block-based and port-based sample times.

  • Pass dialog parameters to S-functions.

  • Model zero crossings and allocate memory for S-functions.

  • Configure code generation settings for S-functions.

S-Function Callback Methods

expand all

Initialize, Output, Terminate

mdlInitializeSizesSpecify the number of inputs, outputs, states, parameters, and other characteristics of the C MEX S-function
mdlInitializeSampleTimesSpecify the sample rates at which this C MEX S-function operates
mdlOutputsCompute the signals that this block emits
mdlUpdateUpdate a block's states
mdlTerminatePerform any actions required at termination of the simulation

Signal Specification

mdlSetDefaultPortComplexSignalsSet the numeric types (real, complex, or inherited) of ports whose numeric types cannot be determined from block connectivity
mdlSetDefaultPortDataTypesSet the data types of ports whose data types cannot be determined from block connectivity
mdlSetDefaultPortDimensionInfoSet the default dimensions of the signals accepted or emitted by a C MEX S-function's ports
mdlSetInputPortComplexSignalSet the numeric types (real, complex, or inherited) of the signals accepted by an input port
mdlSetInputPortDataTypeSet the data types of the signals accepted by an input port
mdlSetInputPortSampleTimeSet the sample time of an input port that inherits its sample time from the port to which it is connected
mdlSetOutputPortComplexSignalSet the numeric types (real, complex, or inherited) of the signals accepted by an output port
mdlSetOutputPortDataTypeSet the data type of the signals emitted by an output port
mdlSetOutputPortSampleTimeSet the sample time of an output port that inherits its sample time from the port to which it is connected

Signal Dimensions

mdlSetInputPortDimensionInfoSet the dimensions of the signals accepted by an input port
mdlSetInputPortDimensionsModeFcnPropagate the dimensions mode
mdlSetInputPortWidthSet the width of an input port that accepts 1-D (vector) signals
mdlSetOutputPortDimensionInfoSet the dimensions of the signals accepted by an output port
mdlSetOutputPortWidthSet the width of an output port that outputs 1-D (vector) signals

Signal Access

mdlSetWorkWidthsSpecify the sizes of the work vectors and create the run-time parameters required by this C MEX S-function
mdlSetInputPortSampleTimeSet the sample time of an input port that inherits its sample time from the port to which it is connected
mdlSetOutputPortSampleTimeSet the sample time of an output port that inherits its sample time from the port to which it is connected
mdlSetWorkWidthsSpecify the sizes of the work vectors and create the run-time parameters required by this C MEX S-function
mdlCheckParametersCheck the validity of a C MEX S-function's parameters
mdlProcessParametersProcess the C MEX S-function's parameters
mdlStartInitialize the state vectors of this C MEX S-function
mdlProcessParametersProcess the C MEX S-function's parameters
mdlSetWorkWidthsSpecify the sizes of the work vectors and create the run-time parameters required by this C MEX S-function

Simulation Information

mdlGetOperatingPointReturn operating point for C MEX S-function as MATLAB data structure
mdlSetOperatingPointRestore operating point of C MEX S-function

Error Handling

mdlStartInitialize the state vectors of this C MEX S-function
mdlTerminatePerform any actions required at termination of the simulation
mdlSetWorkWidthsSpecify the sizes of the work vectors and create the run-time parameters required by this C MEX S-function
mdlZeroCrossingsUpdate zero-crossing vector
mdlInitializeConditionsInitialize the state vectors of this C MEX S-function

SimStruct Functions

expand all

Signal Specification

ssSetNumInputPortsSpecify the number of input ports that a block has
ssSetInputPortComplexSignalSet the numeric type (real or complex) of an input port
ssSetInputPortDataTypeSet the data type of an input port
ssSetInputPortDirectFeedThroughSpecify the direct feedthrough status of a block's ports
ssSetInputPortOffsetTimeSpecify the offset time of an input port
ssSetInputPortRequiredContiguousSpecify that the signal elements entering a port must be contiguous
ssSetInputPortSampleTimeSpecify the sample time of an input port
ssRegisterUnitFromExprRegister unit from unit expression
ssSetInputPortUnitSpecify unit of input port
ssSetNumOutputPortsSpecify the number of output ports that a block has
ssSetOutputPortComplexSignalSet the numeric type (real or complex) of an output port
ssSetOutputPortDataTypeSet the data type of an output port
ssSetOutputPortOffsetTimeSpecify the offset time of an output port
ssSetOutputPortSampleTimeSpecify the sample time of an output port
ssSetOutputPortUnitSpecify unit of output port
ssGetInputPortComplexSignalDetermine whether an input port accepts complex signals.
ssGetInputPortDataTypeGet the data type of an input port
ssGetInputPortDirectFeedThroughDetermine whether a port has direct feedthrough
ssGetInputPortFrameDataDetermine whether a port accepts signal frames
ssGetInputPortOffsetTimeGet the offset time of an input port
ssGetInputPortRequiredContiguousDetermine whether the signal elements entering a port must be contiguous
ssGetInputPortSampleTimeGet the sample time of an input port
ssGetInputPortSampleTimeIndexGet the sample time index of an input port
ssGetInputPortUnitGet unit of input port
ssGetOutputPortComplexSignalGet the numeric type (complex or real) of an output port
ssGetOutputPortDataTypeGet the data type of an output port
ssGetOutputPortFrameDataDetermine whether a port outputs signal frames
ssGetOutputPortOffsetTimeGet the offset time of an output port
ssGetOutputPortSampleTimeGet the sample time of an output port
ssGetOutputPortUnitGet unit of output port
ssAllowSignalsWithMoreThan2DEnable S-function to work with multidimensional signals
ssSetOneBasedIndexInputPortSpecify that an input port expects one-based indices
ssSetOneBasedIndexOutputPortSpecify that an output port emits one-based indices.
ssSetZeroBasedIndexInputPortSpecify that an input port expects zero-based indices
ssSetZeroBasedIndexOutputPortSpecify that an output port emits zero-based indices.

Signal Access

ssGetNumInputPortsGet the number of input ports that a block has
ssGetNumOutputPortsGet the number of output ports that a block has
ssGetInputPortBufferDstPortDetermine the output port that is sharing this input port's buffer
ssGetInputPortConnectedDetermine whether a port is connected to a nonvirtual block
ssGetInputPortOptimOptsGet the reusability setting of the memory allocated to the input port of an S-function
ssGetInputPortOverWritableDetermine whether an input port can be overwritten
ssGetInputPortRealSignalGet the address of a real, contiguous signal entering an input port
ssGetInputPortRealSignalPtrsGet pointers to signals of type double connected to an input port
ssGetInputPortSignalGet the address of a contiguous signal entering an input port
ssGetInputPortSignalPtrsGet pointers to an input port's signal elements
ssGetOutputPortConnectedDetermine whether an output port is connected to a nonvirtual block
ssGetOutputPortBeingMergedDetermine whether the output of this block is connected to a Merge block
ssGetOutputPortOptimOptsGet the reusability setting of the memory allocated to the output port of an S-function
ssGetOutputPortRealSignalGet a pointer to an output signal of type double (real_T)
ssGetOutputPortSignalGet the vector of signal elements emitted by an output port
ssSetInputPortOptimOptsSpecify reusability of the memory allocated to the input port of an S-function
ssSetInputPortOverWritableSpecify whether one of an S-function's input ports can be overwritten by one of its output ports
ssSetOutputPortOptimOptsSpecify reusability of the memory allocated to the output port of an S-function
ssSetOutputPortOverwritesInputPortSpecify whether an output port can share its memory buffer with an input port
ssSetInputPortAcceptExprInRTWSpecify whether a block input accepts a nonconstant expression
ssGetInputPortAcceptExprInRTWDetermine whether a block input accepts a nonconstant expression
ssSetOutputPortOutputExprInRTWSpecify whether a block output generates a nonconstant expression
ssGetOutputPortOutputExprInRTWDetermine whether a block output generates a nonconstant expression

Signal Dimensions

ssSetInputPortDimensionInfoSpecify information about the dimensionality of an input port
ssSetInputPortDimensionsModeSet the dimensions mode of the input port indexed by pIdx
ssSetInputPortDimsSameAsOutputPortDimsSet the dimensions of output port outIdx to be equal to the dimensions of input port inpIdx. This method is called from mdlSetWorkWidths.
ssSetInputPortMatrixDimensionsSpecify dimension information for an input port that accepts matrix signals
ssSetInputPortVectorDimensionSpecify dimension information for an input port that accepts vector signals
ssSetInputPortWidthSpecify the width of an input port
ssPruneNDMatrixSingletonDimsPrune trailing singleton dimensions
ssSetCurrentOutputPortDimensionsSet the current size corresponding to dimension dIdx of the output signal at port pIdx.
ssSetOutputPortDimensionInfoSpecify information about the dimensionality of an output port
ssSetOutputPortDimensionsModeSet the dimensions mode of the output port indexed by pIdx
ssSetOutputPortMatrixDimensionsSpecify dimension information for an output port that emits matrix signals
ssSetOutputPortVectorDimensionSpecify dimension information for an output port that emits vector signals
ssSetOutputPortWidthSpecify the width of an output port
ssSetOutputPortMatrixDimensionsSpecify dimension information for an output port that emits matrix signals
ssAddOutputDimsDependencyRuleRegister a method to handle current dimensions update.
ssAddVariableSizeSignalsRuntimeCheckerRegister a method to check the current input dimensions
ssAllowSignalsWithMoreThan2DEnable S-function to work with multidimensional signals
ssRegMdlSetInputPortDimensionsModeFcnRegister the method to handle dimensions mode propagation for each input port.
ssSetDWorkRequireResetForSignalSizeSet the block flag for resetting the dIndex Dwork size upon subsystem reset.
ssSetSignalSizesComputeTypeSet the type of output dependency on the input signal.
ssSetVectorModeSpecify the vector mode that an S-function supports
ssGetCurrentInputPortDimensionsGet the current size of dimension dIdx of input port pIdx
ssGetCurrentInputPortWidthGet the total width (total number of elements) of the signal at input port pIdx
ssGetInputPortDimensionsGet the dimensions of the signal accepted by an input port
ssGetInputPortDimensionSizeGet the size of one dimension of the signal entering an input port
ssGetInputPortDimensionsModeGet the dimensions mode of the input port indexed by pIdx
ssGetInputPortNumDimensionsGet the dimensionality of the signals accepted by an input port
ssGetInputPortWidthGet the width of an input port
ssGetCurrentOutputPortDimensionsGet the current size of dimension dIdx of the signal at output port pIdx.
ssGetCurrentOutputPortWidthGet the total width (total number of elements) of the signal at output port pIdx.
ssGetOutputPortDimensionsGet the dimensions of the signal leaving an output port
ssGetOutputPortDimensionSizeGet the size of one dimension of the signal leaving an output port
ssGetOutputPortDimensionsModeGet the dimensions mode of the output port indexed by pIdx
ssGetOutputPortNumDimensionsGet the number of dimensions of an output port
ssGetOutputPortWidthGet the width of an output port

Signal Region

ssCallSelectedSignalsFcnInvoke the selected signals function for an S-function
ssCallSigListCreateFcnInvoke the signal list creation function for an S-function
ssCallSigListDestroyFcnInvoke the signal list destruction function for an S-function
ssCallSigListUnavailSigAlertFcnInvoke the unavailable signal alert function for a signal list in an S-function
ssCallGenericDestroyFcnInvoke the generic destruction function for an S-function
ssCallGetPortNameFcnGet the name for a given port
ssCallUnselectSigFcnInvoke the signal deselection function for an S-function
gsl_FirstRegGet the first region of an element in a signal list
gsl_nSigRegionsGet the number of regions in an element of a signal list
gsl_nSigsGet the number of signals in a signal list
gsl_NumElementsGet the number of elements in an element of a signal list
gsl_PortObjGet the port associated with an element of a signal list
gsl_TieWrapDetermine whether an element in a signal list is contiguous
gsr_ComplexDetermine whether the data in a signal region is complex
gsr_currDimsAccess the current dimensions for a variable-size signal in a signal region
gsr_dataAccess the data in a signal region
gsr_DataTypeGet the Simulink data type identifier for a region
gsr_DataTypeSizeGet the size of a single real value in a signal region
gsr_DimsAccess the values in the dimensions vector for a signal region
gsr_nElsGet the number of elements in a region
gsr_NextRegGet next region in the corresponding signal list
gsr_NumDimsGet the number of dimensions of the data in a signal region
gsr_portObjGet the port associated with a signal region
gsr_startIdxGet the index for the element in a signal list at the start of a region
gsr_statusDetermine whether signal in a signal region is available
gsr_UnitGet the Simulink unit identifier for a signal region
gsr_MDetermine number of rows in matrix signal
gsr_NGet the number of rows in or width of a signal
ssGetDTypeIdFromMxArrayGet the data type of an S-function parameter
ssGetNumSFcnParamsGet the number of parameters that an S-Function block expects
ssGetSFcnParamGet a parameter of an S-Function block
ssGetSFcnParamsCountGet the number of block dialog parameters that an S-Function block has
ssSetNumSFcnParamsSpecify the number of parameters that an S-Function block has
ssSetSFcnParamTunableMake a block parameter tunable
ssSetSFcnParamUnitSpecify unit of S-function block parameter
ssGetSFcnParamUnitGet unit of S-function parameter

Sample Time

ssSetSampleTimeSet the period of a sample time
ssSetInputPortSampleTimeSpecify the sample time of an input port
ssSetModelReferenceSampleTimeDefaultInheritanceSpecify that a referenced model containing this S-function can inherit its sample time from its parent model
ssSetModelReferenceSampleTimeDisallowInheritanceSpecify that the use of this S-function in a referenced model prevents the referenced model from inheriting its sample time from its parent model
ssSetModelReferenceSampleTimeInheritanceRuleSpecify whether use of this S-function in a referenced model prevents the referenced model from inheriting its sample time from its parent model
ssSetNumSampleTimesSpecify the number of sample times that an S-Function block has
ssSetOffsetTimeSet the offset time of a block
ssSetTNextSet the time of the next sample hit
ssSetControllableSampleTimeRegister controllable sample time in a block
ssSetNumTicksToNextHitForControllableSampleTimeSchedule number of steps to next event
ssSetNeedAbsoluteTimeRegister if a block requires absolute time
ssSetTimeSourceSet source of time for asynchronous task
ssGetInputPortSampleTimeGet the sample time of an input port
ssGetInputPortSampleTimeIndexGet the sample time index of an input port
ssGetNumSampleTimesGet the number of sample times that a block has
ssGetOffsetTimeGet one of an S-function's sample time offsets.
ssGetOutputPortSampleTimeGet the sample time of an output port
ssGetOutputPortSampleTimeIndexGet sample time index of output port
ssGetPortBasedSampleTimeBlockIsTriggeredDetermine whether a block that uses port-based sample times resides in a triggered subsystem
ssGetSampleTimeGet one of an S-function's sample times.
ssGetTNextGet the time of the next sample hit
ssSetParameterTuningComplianceSpecify sample time behavior and tunability for S-function blocks with port-based sample times
ssGetParameterTuningComplianceGet the sample time behavior and tunability for S-function blocks with port-based sample times
ssIsContinuousTaskDetermine whether a task is continuous
ssIsSampleHitDetermine whether the sample time is hit
ssIsSpecialSampleHitDetermine whether the sample time is hit
ssSampleAndOffsetAreTriggeredDetermine whether a sample time and offset value pair indicate a triggered sample time
ssSampleAndOffsetAreTriggeredOrAsyncDetermine whether a sample time and offset value pair indicate a triggered or asynchronous sample time
ssSetAsyncTimerAttributesdeclares that the Simulink block requires a timer
ssSetAsyncTimerDataType sets the data type of the asynchronous task
ssSetAsyncTaskPrioritiessets the Simulink task priority

Data Type

ssRegisterDataTypeRegister a custom data type
ssRegisterDataTypeIntegerRegister integer data type and return its data type ID
ssRegisterTypeFromNamedObjectRegister a custom data type from a Simulink.AliasType, Simulink.NumericType, or Simulink.Bus object.
ssSetDataTypeSizeSet the size of a custom data type
ssSetDataTypeZeroSet the zero representation of a data type
ssSetInputPortDataTypeSet the data type of an input port
ssSetOutputPortDataTypeSet the data type of an output port
ssGetDataTypeIdGet the ID of a data type
ssGetDataTypeIdAliasedThruToGet the base data type associated with a data type alias
ssGetDataTypeIsIntegerDetermine whether registered data type is integer
ssGetDataTypeIsSpecifiedIntegerDetermine whether registered data type is integer with specified signedness and word length
ssGetDataTypeNameGet the name of a data type
ssGetDataTypeSizeGet the size of a custom data type
ssGetDataTypeZeroGet the zero representation of a data type
ssGetInputPortDataTypeGet the data type of an input port
ssGetNumDataTypesGet number of data types registered for this simulation, including built-in types
ssGetOutputPortDataTypeGet the data type of an output port
ssGetOutputPortSignalGet the vector of signal elements emitted by an output port
ssGetSFcnParamDataTypeGet the data type of a parameter for an S-Function block

Buses

ssGetBusElementComplexSignalGet the signal complexity for a bus element
ssGetBusElementDataTypeGet the data type identifier for a bus element
ssGetBusElementDimensionsGet the dimensions of a bus element
ssGetBusElementNameGet the name of a bus element
ssGetBusElementNumDimensionsGet the number of dimensions for a bus element
ssGetBusElementOffsetGet the offset from the start of the bus data type to a bus element
ssGetNumBusElementsGet the number of elements in a bus signal
ssGetSFcnParamNameGet the value of a block parameter for an S-function block
ssIsDataTypeABusDetermine whether a data type identifier represents a bus
ssRegisterTypeFromParameterRegister a data type that a parameter in the Simulink data type table specifies
ssRegisterTypeFromNamedObjectRegister a custom data type from a Simulink.AliasType, Simulink.NumericType, or Simulink.Bus object.
ssSetBusInputAsStructSpecify whether to convert the input bus signal for an S-function from virtual to nonvirtual
ssSetBusOutputAsStructSpecify whether the output bus signal from an S-function must be virtual or nonvirtual
ssSetBusOutputObjectNameSpecify the name of the bus object that defines the structure and type of the output bus signal

Strings

ssGetInputStringLengthGet length of string from input port
ssGetStringDataTypeMaxLengthGet maximum length of string data type
ssIsStringDataTypeDetermine if data type is string
ssReadInputStringRead C string from input port
ssRegisterStringDataTypeRegister string data type
ssWriteOutputStringWrite C string to output port
ssGetNumRunTimeParamsGet the number of run-time parameters created by this S-function
ssGetRunTimeParamInfoGet the attributes of a run-time parameter
ssRegAllTunableParamsAsRunTimeParamsRegister all tunable parameters as run-time parameters
ssRegDlgParamAsRunTimeParamRegister a dialog parameter as a run-time parameter
ssSetNumRunTimeParamsSpecify the number of run-time parameters created by this S-function
ssSetRunTimeParamInfoSpecify the attributes of a run-time parameter
ssUpdateAllTunableParamsAsRunTimeParamsUpdate the values of run-time parameters to be the same as those of the corresponding tunable dialog parameters
ssUpdateDlgParamAsRunTimeParamUpdate a run-time parameter that corresponds to a dialog parameter
ssUpdateRunTimeParamDataUpdate the value of a run-time parameter
ssUpdateRunTimeParamInfoUpdate the attributes of a run-time parameter

Function-Call Subsystems

ssCallSystemWithTidCall the update and outputs methods of a function-call subsystem
ssDisableSystemWithTidDisable a function-call subsystem connected to this S-Function block
ssEnableSystemWithTidEnable a function-call subsystem connected to this S-function
ssGetCallSystemNumFcnCallDestinations Get the number of function-call destinations.
ssGetExplicitFCSSCtrlDetermine whether this S-function explicitly enables and disables the function-call subsystems that it invokes
ssSetCallSystemOutputSpecify that an output port is issuing a function call
ssSetExplicitFCSSCtrlSpecify whether this S-function explicitly enables and disables the function-call subsystem that it calls

Simulink Functions

ssDeclareSimulinkFunctionDeclare Simulink function with a given function prototype and scope.
ssDeclareFunctionCallerDeclare Simulink function call with a given function prototype.
ssCallSimulinkFunctionCall a declared Simulink function of a given function prototype at run time.
ssQuerySimulinkFunctionDetermine if function name is declared as a Simulink Function.
ssGetSimulinkFunctionInputGet a pointer to an input argument passed to a Simulink Function.
ssGetSimulinkFunctionOutputGet a pointer to an output argument passed to a Simulink Function.
ssSetSimulinkFunctionArgComplexityDeclare complexity of a Simulink Function argument.
ssSetSimulinkFunctionArgDataTypeDeclare data type of Simulink Function argument.
ssSetSimulinkFunctionArgDimensionsDeclare dimension of Simulink Function argument.

Model Reference

ssRTWGenIsModelReferenceRTWTargetDetermine if the model reference Simulink Coder target is generating
ssRTWGenIsModelReferenceSimTargetDetermine if the model reference simulation target is generating
ssSetModelReferenceNormalModeSupportSpecify if S-function can be used in referenced model that simulates in normal mode
ssSetModelReferenceSampleTimeDefaultInheritanceSpecify that a referenced model containing this S-function can inherit its sample time from its parent model
ssSetModelReferenceSampleTimeDisallowInheritanceSpecify that the use of this S-function in a referenced model prevents the referenced model from inheriting its sample time from its parent model
ssSetModelReferenceSampleTimeInheritanceRuleSpecify whether use of this S-function in a referenced model prevents the referenced model from inheriting its sample time from its parent model
ssSetSupportedForCodeReuseAcrossModelsSpecify if S-function can be reused across models

Simulation Information

ssSetStateAbsTolSet the absolute tolerance used by a variable-step solver for a specific S-function continuous state.
ssSetBlockReductionRequest that the Simulink engine attempt to reduce a block
ssSetOperatingPointComplianceSpecify how the software handles S-function operating point information when saving and restoring model operating point
ssSetOperatingPointVisibilitySpecify whether S-function operating point is accessible in model operating point
ssSetSolverNeedsResetAsk Simulink engine to reset solver
ssSetSkipContStatesConsistencyCheckAsk Simulink engine to skip continuous state consistency check
ssSetStopRequestedSet the simulation stop requested flag
ssGetBlockReductionDetermine whether a block has requested block reduction before the simulation has begun and whether it has actually been reduced after the simulation loop has begun
ssGetErrorStatusGet a character vector that identifies the last error
ssGetFixedStepSizeGet the fixed step size of the model containing the S-function.
ssGetMaxStepSizeGet the maximum step size used by the model containing the S-function.
ssGetMinStepSizeGet the minimum step size used by the model containing the S-function.
ssGetSimModeGet the simulation mode of an S-Function block
ssGetSimStatusGet the current simulation status of an S-Function block
ssGetSolverModeGet the solver mode being used to solve the S-function
ssGetSolverNameGet the name of the solver being used to solve the S-function
ssGetStateAbsTolGet the absolute tolerance used by the variable-step solver for a specified state
ssGetStopRequestedGet the value of the simulation stop requested flag
ssGetTGet the current simulation time
ssGetTaskTimeGet the current time for the current task
ssGetTFinalGet the simulation stop time
ssGetTNextGet the time of the next sample hit
ssGetTStartGet the simulation start time
ssIsExternalSimDetermine if the model is running in external mode.
ssIsFirstInitCondDetermine whether the simulation time is equal to the start time.
ssIsModeUpdateTimeStepDetermine whether update to mode vector is allowed on time step
ssIsMajorTimeStepDetermine whether the simulation is in a major step
ssIsMinorTimeStepDetermine whether the simulation is in a minor step
ssIsVariableStepSolverDetermine if a variable-step solver is being used to solve the S-function
ssRTWGenIsAccelerator Determine if the model is running in Accelerator mode.
ssIsRapidAcceleratorActiveDetermine whether the model is running in Rapid Accelerator mode

Error Handling

ssGetErrorStatusGet a character vector that identifies the last error
ssGetLocalErrorStatusGet a character vector that identifies the last error
ssPrintfPrint a variable-content message
ssSetErrorStatusReport an error
ssSetLocalErrorStatusReport an error in a thread-safe manner
ssWarningDisplay a warning message

Information and Options

ssSetOptionsSpecify S-function options
ssCallExternalModeFcnInvoke the external mode function for an S-function
ssGetSFunctionNameGet the name of the S-Function
ssGetBlockDiagramNameGet the name of Simulink model the S-Function is in
ssGetModelNameGet the model name
ssGetPathGet the path of a block
ssGetUserDataAccess user data
ssSetExternalModeFcnSpecify the external mode function for an S-function
ssSetPlacementGroupSpecify the name of the placement group of a block
ssSetUserDataSpecify user data
ssSupportsMultipleExecInstancesSpecify that a For Each Subsystem block supports an S-function operating inside the subsystem.

Set Options for Block Dwork Vectors

ssSetNumDWorkSpecify the number of Dwork vectors used by a block
ssSetDWorkComplexSignalSpecify whether the elements of a Dwork vector are real or complex
ssSetDWorkDataTypeSpecify the data type of a Dwork vector
ssSetDWorkNameSpecify the name of a Dwork vector
ssSetDWorkUsageTypeSpecify how DWork vector is used in S-function
ssSetDWorkUsedAsDStateSpecify that a Dwork vector is used as a discrete state vector
ssSetDWorkWidthSpecify the width of a Dwork vector

Get Options for Block Dwork Vectors

ssGetNumDWorkGet the number of Dwork vectors used by a block
ssGetDWorkGet a DWork vector
ssGetDWorkComplexSignalDetermine whether the elements of a Dwork vector are real or complex numbers
ssGetDWorkDataTypeGet the data type of a Dwork vector
ssGetDWorkNameGet the name of a Dwork vector
ssGetDWorkUsageTypeDetermine how DWork vector is used in S-function
ssGetDWorkUsedAsDStateDetermine whether a Dwork vector is used as a discrete state vector
ssGetDWorkWidthGet the size of a Dwork vector
ssGetdXGet the derivatives of a block's continuous states

Set Options for Block States

ssSetNumContStatesSpecify the number of continuous states that a block has
ssSetNumDiscStatesSpecify the number of discrete states that a block has
ssSetNumNonsampledZCsSpecify the number of states for which a block detects zero crossings that occur between sample points

Get Options for Block States

ssGetContStatesGet a block's continuous states
ssGetDiscStatesGet a block's discrete states
ssGetRealDiscStatesGet a block's discrete state vector
ssGetNonsampledZCsGet the zero-crossing signal values
ssGetNumContStatesGet the number of continuous states that a block has
ssGetNumDiscStatesGet the number of discrete states that a block has
ssGetNumNonsampledZCsGet the size of the zero-crossing vector

Options for Block Work Vectors

ssSetNumRWorkSpecify the size of a block's floating-point work vector
ssGetNumRWorkGet the size of a block's floating-point work vector
ssGetRWorkGet a block's floating-point work vector
ssGetRWorkValueGet an element of a block's floating-point work vector
ssSetRWorkValueSet an element of a block's floating-point work vector
ssSetNumIWorkSpecify the size of a block's integer work vector
ssGetNumIWorkGet the size of a block's integer work vector
ssGetIWorkGet a block's integer work vector
ssGetIWorkValueGet an element of a block's integer work vector
ssSetIWorkValueSet an element of a block's integer work vector
ssSetNumPWorkSpecify the size of a block's pointer work vector
ssGetNumPWorkGet the size of a block's pointer work vector
ssGetPWorkGet a block's pointer work vector
ssGetPWorkValueGet a pointer from a block's pointer work vector
ssSetPWorkValueSet an element of a block's pointer work vector
ssSetNumModesSpecify the size of the block's mode vector
ssGetNumModesGet the size of the mode vector
ssGetModeVectorGet mode vector
ssGetModeVectorValueGet an element of a block's mode vector
ssSetModeVectorValueSet an element of a block's mode vector

Get Code Generation Information

ssGetDWorkRTWIdentifierGet the identifier used to declare a DWork vector in code generated from the associated S-function
ssGetDWorkRTWIdentifierMustResolveToSignalObjectGet a flag indicating if a DWork vector resolves to a Simulink.Signal object
ssGetDWorkRTWStorageClassGet the storage class of a DWork vector in code generated from the associated S-function
ssGetDWorkRTWTypeQualifierGet the C type qualifier (e.g., const) used to declare a DWork vector in code generated from the associated S-function
ssGetPlacementGroupGet the name of the placement group of a block
ssRTWGenIsCodeGenIdentify any code generation that is not used by the Accelerator.

Set Code Generation Information

ssSetArrayLayoutForCodeGenSpecify array layout of the S-function
ssSetDWorkRTWIdentifierSpecify the identifier used to declare a DWork vector in code generated from the associated S-function
ssSetDWorkRTWIdentifierMustResolveToSignalObjectSpecify if a DWork vector resolves to a Simulink.Signal object
ssSetDWorkRTWStorageClassSpecify the storage class of a DWork vector in code generated from the associated S-function
ssSetDWorkRTWTypeQualifierSpecify the C type qualifier (e.g., const) used to declare a DWork vector in code generated from the associated S-function
ssSetPlacementGroupSpecify the name of the placement group of a block

Write Information to model.rtw File

ssWriteRTW2dMatParamWrite a matrix parameter to the model.rtw file
ssWriteRTWMx2dMatParamWrite a matrix parameter in MATLAB format to the model.rtw file
ssWriteRTWMxVectParamWrite a vector parameter in MATLAB format to the model.rtw file
ssWriteRTWParametersWrite tunable parameter information to the model.rtw file
ssWriteRTWParamSettingsWrite values of nontunable parameters to the model.rtw file
ssWriteRTWScalarParamWrite a scalar parameter to the model.rtw file
ssWriteRTWStrWrite a character vector to the model.rtw file
ssWriteRTWStrParamWrite a character vector parameter to the model.rtw file
ssWriteRTWStrVectParamWrite a vector of character vector parameters to the model.rtw file
ssWriteRTWVectParamWrite a vector parameter to the model.rtw file
ssWriteRTWWorkVectWrite work vectors to the model.rtw file
ssSetNeedAbsoluteTimeRegister if a block requires absolute time
ssGetNeedAbsoluteTimeCheck if the S-function block has registered that it requires absolute time
ssSetNeedElapseTimeRegister if a block requires elapsed time
ssGetNeedElapseTimeCheck if the S-function block has registered that it requires elapsed time
ssGetElapseTimeGet the value of elapse time counter associated with the S-function
ssGetElapseTimeCounterGet the integer value of the elapse time counter associated with the S-function
ssGetElapseTimeResolutionGet the sample time of the elapse time counter associated with the S-function
ssGetElapseTimeCounterDtypeGet the data type of the elapse time counter associated with the S-function

Topics