I don't find the way to get the string specified in the dialog box of an S-function (C, level 2) block and save it in a variable, inside the .c file corresponding to the block.
Through *mxGetPr(ssGetSFcnParam(S, 0)) I can only get the first position value in the string. The parameter entered in the dialog block what it is related to the ssGetSFcnParam(S, 0) is '123'. In the mask editor of the block the type is 'edit'.
#define S_FUNCTION_NAME ver_file_data #define S_FUNCTION_LEVEL 2 #define NPARAMS 14 #define DVC_TYPE(S) ssGetSFcnParam(S, 0) static void mdlInitializeSizes(SimStruct *S){ DECL_AND_INIT_DIMSINFO(outputDimsInfo); ssSetNumSFcnParams(S, NPARAMS); /* Number of expected parameters */ ssSetSFcnParamTunable(S, 0, 0); ssSetSFcnParamTunable(S, 1, 0); #if defined(MATLAB_MEX_FILE) if (ssGetNumSFcnParams(S) == ssGetSFcnParamsCount(S)) { mdlCheckParameters(S); if (ssGetErrorStatus(S) != NULL) { return; } } else { return; } #endif ssSetNumContStates(S, 0); ssSetNumDiscStates(S, 0); if (!ssSetNumInputPorts(S, NUM_INPUTS)) return; if (!ssSetNumOutputPorts(S, NUM_OUTPUTS)) return; /* Output Port 0 */ ssSetOutputPortWidth(S, 0, 1); ssSetOutputPortDataType(S, 0, SS_UINT8); ssSetNumSampleTimes(S, 1); ssSetNumRWork(S, 0); ssSetNumIWork(S, 0); ssSetNumPWork(S, 0); ssSetNumModes(S, 0); ssSetNumNonsampledZCs(S, 0); } static void mdlInitializeSampleTimes(SimStruct *S){ ssSetSampleTime(S, 0, -1); ssSetOffsetTime(S, 0, 0.0); } static void mdlOutputs(SimStruct *S, int_T tid){ ssPrintf("DVC_IND_NO = %x\n",*mxGetPr(DVC_IND_NO(S))); } mdlRTW (SimStruct *S){ }
Before getting anything through the outputport, I would like to be able to print with ssPrintf("DVC_IND_NO = %x\n",*mxGetPr(DVC_IND_NO(S))); the 123.
Thank you, best regards.