Why 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?

2 views (last 30 days)
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

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
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.

More Answers (0)

Categories

Find more on Simulink Coder in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!