Technical data

3
Writing Target Language Files
3-42
For example, given the 2-by-3 matrix
model.h defines:
typedef struct Parameters_tag = {
struct { /* S-function */
real_T matSize[2];
real_T mat[3][2];
} sfuncBlock;
struct { /* any non S-function */
real_T mat[2][3];
} nonSfuncBlock;
} Parameters;
model.prm
declares:
Paramters rtP = {
{ 2, 3 },
{ 1, 4, 2, 5, 3, 6 },
{ 1, 2, 3, 4, 5, 6 }
};
The Target Language Compiler access routines, LibBlockMatrixParameter
and
LibBlockMatrixParameterAddr, return:
LibBlockMatrixParameter(mat, "", "", 0, "", "", 1) returns
non-S-function: 2
S-function: 2
LibBlockMatrixParameterAddr(mat, "", "", 0, "", "", 1) returns
non-S-function: &rtP.nonSfuncBlock[0][1];
S-function: &rtP.sfuncBlock[1][0];
Matrix parameters are like any other TLC parameters in that only those
parameters explicitly accessed by a TLC library function during code
generation are placed in the parameters structure. So,
matSize is not declared
123
456