Writing S-Functions | ![]() ![]() |
Write values of nontunable parameters to the model.rtw
file.
Syntax
int_T ssWriteRTWParamSettings(SimStruct *S, int_T nParamSettings, int_T paramType, const char_T *settingName, ...)
Arguments
S
SimStruct representing an S-Function block.
nParamSettings
Number of parameter settings.
paramType
Type of parameter (see Parameter Setting Type-Specific Arguments).
settingName
Name of parameter.
...
Remaining arguments depend on the parameter type (see Parameter Setting Type-Specific Arguments).
Description
Use this function in mdlRTW
to write nontunable parameter setting information to this S-function's model.rtw
file. A nontunable parameter is any parameter that the S-function has declared as nontunable, using the ssSetParameterTunable macro. You can also use this macro to write out other constant values required to generate code for this S-function.
This function returns true if successful.
Parameter Setting Type-Specific Arguments
This section lists the parameter-specific arguments required by each parameter type.
SSWRITE_VALUE_STR
(unquoted stringArgument |
Description |
const char_T *value |
String (e.g., U.S.A. ) |
SSWRITE_VALUE_QSTR
(quoted string)Argument |
Description |
const char_T *value |
String (e.g., "U.S.A." ) |
SSWRITE_VALUE_VECT_STR
(vector of strings)Argument |
Description |
const char_T *value |
Vector of strings (e.g., ["USA", "Mexico"] ) |
int_T nItemsInVect |
Size of the vector |
SSWRITE_VALUE_NUM
Argument |
Description |
const real_T value |
Number (e.g., 2 ) |
SSWRITE_VALUE_VECT
(vector of numbers)Argument |
Description |
const real_T *value |
Vector of numbers (e.g., [300, 100] ) |
int_T vectLen |
Size of the vector |
SSWRITE_VALUE_2DMAT
(matrix of numbers)Argument |
Description |
const real_T *value |
Matrix of numbers (e.g., [[170, 130],[60, 40]] ) |
int_T nRows |
Number of rows in the vector |
int_T nCols |
Number of columns in the vector |
SSWRITE_VALUE_DTYPE_NUM
(data typed number)Argument |
Description |
const void *value |
Number (e.g., [3+4i] ) |
int_T dtInfo |
Data type (see Specifying Data Type Info) |
SSWRITE_VALUE_DTYPE_VECT
(data typed vector)Argument |
Description |
const void *value |
Data-typed vector (e.g., [1+2i, 3+4i] ) |
int_T vectLen |
Size of the vector |
int_T dtInfo |
Data type (see Specifying Data Type Info) |
SSWRITE_VALUE_DTYPE_2DMAT
(data-typed matrix)Argument |
Description |
const void *value |
Matrix (e.g., [1+2i 3+4i; 5 6] ) |
int_T nRows |
Number of rows in the matrix |
int_T nCols |
Number of columns in the matrix |
int_T dtInfo |
Data type (see Specifying Data Type Info) |
SSWRITE_VALUE_DTYPE_ML_VECTOR
(data-typed MATLAB vector)Argument |
Description |
const void *RValue |
Real component of the vector (e.g., [1 3] ) |
const void *IValue |
Imaginary component of the vector (e.g., [2 5] ) |
int_T vectLen |
Number of elements in the vector |
int_T dtInfo |
Data type (see Specifying Data Type Info) |
SSWRITE_VALUE_DTYPE_ML_2DMAT
(data typed MATLAB matrix)Argument |
Description |
const void *RValue |
Real component of the matrix (e.g., [1 5 3 6] ) |
const void *IValue |
Real component of the matrix (e.g., [2 0 4 0] ) |
int_T nRows |
Number of rows in the matrix |
int_T nCols |
Number of columns in the matrix |
int_T dtInfo |
Data type (see Specifying Data Type Info) |
Example
See simulink/src/sfun_multiport.c
for an example that uses this function.
Languages
See Also
mdlRTW, ssSetParameterTunable
![]() | ssWriteRTWParameters | ssWriteRTWScalarParam | ![]() |