Target Language Compiler | ![]() ![]() |
Exception to Using the Library Functions
An exception to using these functions is when you access parameter settings for a block. Parameter settings can be written out using the mdlRTW
function of a C-MEX S-function. They can contain data in the form of strings, scalar values, vectors, and matrices. They can be used to pass nonchanging values and information that is then used to affect the generated code for a block or directly as values in the resulting code of a block.
mdlRTW Function in C-MEX S-Function Code
static void mdlRTW(SimStruct *S) { if (!ssWriteRTWParamSettings( S, 1, SSWRITE_VALUE_QSTR, "Operator", "AND")) { ssSetErrorStatus(S,"Error writing parameter data to .rtw file"); return; } }
Resulting Block Record in model.rtw File
TLC Code to Access the Parameter Settings
%function Outputs(block, system) Output %% %% Select Operator %switch(SFcnParamSettings.Operator) %case "AND" %assign LogicOp = "&" %break ... %endswitch %endfunction
For more details on using parameter settings, see Inlining S-Functions.
![]() | Using Library Functions to Access model.rtw Contents | Directives and Built-in Functions | ![]() |