MATLAB: Is there an example that demonstrates the use of matrix parameters within S-Function Builder for Simulink 6.3 (R14SP3)

2-darraysbuildermatricesparameterss-functionsimulink

I am attempting to convert the example "Example of a Discrete State S-Function" into an S-function built by S-Function Builder. However, when I try to introduce the four matrices (C and D under "Outputs", and A and B under "Discrete update") as parameters, I cannot find any way to do so, since parameters such as A[2][2] or A[4] are refused by the build procedure. I do not know how to enter parameters other than scalars into the S-Function Builder.

Best Answer

This bug has been fixed in Release 2007a (R2007a). For previous product releases, read below for any possible workarounds:
You can create matrix parameters in the S-function Builder for Simulink 6.3 (R14SP3) using the Parameters tab in the Data Properties pane of the S-function Builder GUI. You can find an example model attached to this solution which demonstrates the use of S-Function Builder with 2D arrays (A, B, C, and D) as parameters. Note that the update and outputs function need to reference these 2D arrays by their linear index.