MATLAB: Do I receive an “rtwgen” error when using Fuzzy Inference System (FIS) in a referenced model

fismodelreferncertwgensimulink

I am trying to build a large model that contains several referenced models. One of those referenced models contains a FIS. When I build just the referenced model with the FIS it works very well. However, when I move up to the main model and then try to build, the RTW code generator gives the following error:
Error using ==> rtwgen
Invalid parameters for S-function 'Test_FIS_RefModel/Fuzzy Logic Controller1/FIS S-function'. For Real-Time Workshop, S-function parameters must be numeric or char array and only 1 and 2-d non-sparse arrays are supported.

Best Answer

This enhancement has been incorporated in Release 2009b (R2009b). For previous product releases, read below for any possible workarounds:
There is a limitation in Simulink 6.6 while generating code for a referenced model that handles S-functions with structures as parameters.
Your model has structures as parameters in the fuzzy controller FIS, and an S-function is being created around that during the RTW build process, which is leading to the error.
To work around this issue, use a subsystem instead of a referenced model where you have structures as parameters, as in the fuzzy controller FIS.