The struct type is opaque for the MATLAB Coder. So it will not have the information about he fields. Can you please try the below work arounds :
- If you wan to access each fields then write a wrapper to access them like below
float access_struct_field1(void) {
data->field1;
}
unsigned access_struct_field2(void) {
data->field2;
}
then invoke these calls through coder.ceal as necessary.
- Do the struct operation in another wrapper function
Consider you want to do addition of the struct fields, then you can do these operations in another C wrapper function
float myStructOperations(myStruct* aStruct ) {
reutrn (float)(aStruct->field1+aStruct->field2);
}
In MATLAB you can do like below
structPtr = coder.opaque('myStruct *','NULL','HeaderFile','struct_header.h');
structPtr = coder.ceval('access_structData');
output = coder.ceval('myStructOperations',structPtr);