MATLAB: S-Functions: ssWriteRTWParamSettings in mdlRTW does not work.

cinline()MATLABmdlrtwparameterss-functionsimulinksimulink codersswritertwparamsettingstlc

Hey there,
I've got a problem regarding the inlining of some C S-Functions.
My S-Function expects some non tuneable parameters (e.g., "port_number"), which I try to write to the .rtw file in order to access them with my corresponding .tlc file.
My C Code looks as follows:
#define PORT_NUMBER (( uint8_T )( mxGetPr( ssGetSFcnParam( S , PORT_NUMBER_IDX ) )[ 0 ] ) + (uint8_T)1 )
static void mdlRTW(SimStruct *S)
{
if(!ssWriteRTWParamSettings (S, 1, SSWRITE_VALUE_NUM, "port_number", PORT_NUMBER))
{
return; /* An error occurred. */
}
}
I tried accessing the parameter with
%assign port_number = SFcnParamSettings.port_number
in my tlc file, but when building the model, I kept getting "unidentified identifier SFcnParamSettings".
Subsequently I searched the built .rtw file for "SFcnParamSettings", but nothing was found. Shouldn't there be a block with this title in it? For me it looks like the mdlRTW function wasn't executed correctly, but why?
And how can I check if it works?

Best Answer

Note: This seems to be triggered by the same problem I encountered here. I built the model in my own development path using copies of all relevant files/libraries instead of doing so in the original project folder.
I do not know about Matlab's exact problem before, but building in the original folder solved the issue. Again, I find Matlab's error reporting kind of misleading.
With kind regards,
Eike