Hello, I have a C++ Level 2 Sfunction that is compiling via Mex but when i bring it into simulink, it shows only one input port, and one output port. Not sure what i need to do here. Am i missing something?
#ifdef __cplusplusextern "C" { // use the C fcn-call standard for all functions #endif // defined within this scope #define S_FUNCTION_LEVEL 2...#define NParam 207 // Total number of paramters#define NInputs 205 // Number of input ports#define NOutputs 52 // Total Number of output ports... (some omitted #defines)#include "simstruc.h"... (some omitted #includes)static void mdlInitializeSizes(SimStruct *S){ /* Number of expected parameters */ ssSetNumSFcnParams(S, NParam); if (ssGetNumSFcnParams(S) != ssGetSFcnParamsCount(S)) { /* Return if number of expected != number of actual parameters */ return; } /* Setup for input ports */ if (!ssSetNumInputPorts(S, NInputs)) return; for (int i=0; i<NInputs; i++){ /* loop stuff ommited /*} /* Setup for output ports */ if (!ssSetNumOutputPorts(S, NOutputs)) return; for (int j=0; j<NOutputs; j++){ /* loop stuff ommited /*} /* No continuous and discrete states */ ssSetNumContStates(S, 0); ssSetNumDiscStates(S, 0); ssSetNumSampleTimes(S, NSampleTimes); ssSetNumRWork(S, NUMRWORK); ssSetNumIWork(S, NUMIWORK); ssSetNumPWork(S, NUMPWORK); ssSetNumModes(S, NUMMODES); ssSetNumNonsampledZCs(S, 0); ssSetOptions(S, 0);}... (some other functions)
Best Answer