C code generation - dataStack datatype

I have this Matlab function (mfile):
function [NPIfilt offNPIfilt predNPIfilt stateOut stateOutVar RR] = NPI(pv,sp,op,status,par,stateIn,stateInVar)
I need to call this function from Simulink simulation (run for whole simulation time), and I would prefer to have it as C code (in a S-function). So I created the C code via Matlab coder: codegen -report NPI.m -args {pv,sp,op,status,par,stateIn,stateInVar} , but in the C code there is one additional parameter of the function: NPIStackData *SD (the signature of function is:
void NPI(NPIStackData *SD, real_T pv, real_T sp, real_T op, real_T status, const real_T par[18], const real_T stateIn[16], const real_T stateInVar[1984], real_T *NPIfilt, real_T *offNPIfilt, real_T *predNPIfilt, real_T stateOut[16], real_T *stateOutVar, real_T RR[3])).
The datatype NPIStackData is defined in :
14 typedef struct
15 {
16 struct
17 {
18 creal_T alpha1_data[1983];
19 creal_T beta1_data[1983];
20 } f0;
21 struct
22 {
23 creal_T eiga_data[1983];
24 } f1;
25 struct
26 {
27 creal_T x_data[1983];
28 } f2;
29 struct
30 {
31 real_T stateInVar[1984];
32 } f3;
33 } NPIStackData;
What is the reason for this new datatype, and how should I deal with it (how to initialize it in order to be able to call the function? Thank you very much.

回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeSimulink Coder についてさらに検索

質問済み:

2012 年 8 月 20 日

Community Treasure Hunt

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

Start Hunting!

Translated by