MATLAB: Do I receive an error when I use Real-Time Workshop to generate code for a model when I am passing a structure or cell array parameter to an S-function block

arrayblockcellcodeerrorgenerationparameterpassrealreal times-functionsimulink coderstructuretimeworkshopxpc

I am passing a cell array or structure as a parameter to an S-function block. This works fine in normal Simulink simulations. However, if I try to generate code, I receive the following error:
S-function block 'mysfun/S-Function' parameters must be numeric arrays for Real-Time Workshop

Best Answer

This bug has been fixed for Release 14 SP1 (R14SP1). For previous releases, please read below for any possible workarounds:
Documentation on the supported S-function parameter types is missing from Real-Time Workshop.
It is not possible to pass a structure or cell array parameter to an S-function block when generating code for Real-Time Workshop.
As a workaround, you should use numerical or character string parameters for your S-Function that fit the following guidelines:
1. Parameters must be numeric, logical, or character arrays.
2. Parameters may not be sparse.
3. Parameter arrays must not be greater than 2 dimensions.