How to change the mxCreateCellMatrix and mxCreateString in FAST_SFunc.c

Hello everybody,

Halle All, Please I have a question. How can I write this function without mxCreateCellMatrix and mxSetCell? Because the Simulink Coder can not support this. Thank you in advance. Greeting David

// put the names of the output channels in a cell-array variable called “OutList” in the base matlab workspace
m = NumOutputs;
n = 1;
pm = mxCreateCellMatrix(m, n);
for (i = 0; i < NumOutputs; i++){
while (ChannelNames[i*CHANNEL_LENGTH + j] == ’ '){
strncpy(&OutList[0], &ChannelNames[i*CHANNEL_LENGTH], j+1);
OutList[j + 1] = ‘\0’;

      chrAry = mxCreateString(OutList);
      indx = i;
      mxSetCell(pm, indx, chrAry);
   ErrStat = mexPutVariable("base", "OutList", pm);

You could just ignore that code. If you need the channel names in your simulink model, you can either hard-code them or read the channel names from the FAST summary file that is generated.

Dear Bonnie,
Thanks for your answer. If I ignore this code, I get the following mistakes:

Error occurred while executing External Mode MEX-file ‘rtwinext’:
Error loading real-time image: undefined symbol “min”

Do you maybe have an idea?

This sounds like a similar error people had when compiling with certain C compilers that don’t have a min() function defined automatically. You can search this forum to see if/how anyone solved it.