Writing S-Functions | ![]() ![]() |
Write tunable parameter information to model.rtw
file.
Syntax
int_T ssWriteRTWParameters(SimStruct *S, int_T nParams, int_T
paramType, const char_T *paramName, const char_T *stringInfo,
...)
Arguments
S
SimStruct representing an S-function block.
Description
Use this function in mdlRTW
to write tunable parameter information to this S-function's model.rtw
file. This function returns TRUE
if successful.
Note This function is provided for compatibility with S-functions that do not use run-time parameters. It is suggested that you use run-time parameters (see Run-Time Parameters). If you do use run-time parameters, you do not need to use this function. |
Parameter Type-Specific Arguments
This section lists the parameter-specific arguments required by each parameter type.
SS_WRITE_VALUE_VECT (
vector parameterArgument |
Description |
const real_T *valueVect |
Pointer to array of vector values |
int_T vectLen |
Length of vector |
SSWRITE_VALUE_2DMAT (
matrix parameter)Argument |
Description |
const real_T *valueMat |
Pointer to array of matrix elements |
int_T nRows |
Number of rows in matrix |
int_T nCols |
Number of columns in matrix |
SSWRITE_VALUE_DTYPE_2DMAT
Argument |
Description |
const real_T *valueMat |
Pointer to array of matrix elements |
int_T nRows |
Number of rows in matrix |
int_T nCols |
Number of columns in matrix |
int_T dtInfo |
Data type of matrix elements (see Specifying Data Type Info) |
SSWRITE_VALUE_DTYPE_ML_VECT
Argument |
Description |
const void *rValueVect |
Real component of complex vector |
const void *iValueVect |
Imaginary component of complex vector |
int_T vectLen |
Length of vector |
int_T dtInfo |
Data type of vector (see Specifying Data Type Info) |
SSWRITE_VALUE_DTYPE_ML_2DMAT
Specifying Data Type Info
The data type of value argument passed to the ssWriteRTW
macros is obtained using
DTINFO(dTypeId, isComplex),
where dTypeId
can be any one of the enum values in BuitlInDTypeID
(SS_DOUBLE
, SS_SINGLE
, SS_INT8
, SS_UINT8
, SS_INT16
, SS_UINT16
, SS_INT32
, SS_UINT32
, SS_BOOLEAN
) defined in simstuc_types.h
. The isComplex
argument is either 0
or 1
.
For example, DTINFO(SS_INT32,0)
is a noncomplex 32-bit signed integer.
If isComplex==1
, it is assumed that the array of values has the real and imaginary parts arranged in an interleaved manner (i.e., Simulink format). If you prefer to pass the real and imaginary parts as two separate arrays, you should use the macros ssWriteRTWMxVectParam or ssWriteRTWMx2dMatParam.
Example
See simulink/src/sfun_multiport.c
for an example that uses this function.
Languages
See Also
mdlRTW
![]() | ssWriteRTWMx2dMatParam | ssWriteRTWParamSettings | ![]() |