Reputation: 949
I have converted a simple code to C++ using Matlab coder. However, my main problem is that I cannot get its output! How can I convert the output which is an emxArray_real_T type to a C++ array and print it?
Upvotes: 1
Views: 2064
Reputation: 2817
C Code Interface for Dynamically Allocated Arrays
In generated code, MATLAB represents dynamically allocated data as a structure type called emxArray. An embeddable version of the MATLAB mxArray, the emxArray is a family of data types, specialized for all base types. emxArray Structure Definition
typedef struct emxArray_<baseTypedef> { <baseType> *data; int *size; int allocatedSize; int numDimensions; boolean_T canFreeData; } emxArray_<baseTypedef>;
baseTypedef is the predefined type in rtwtypes.h corresponding to baseType. For example, here is the definition for an emxArray of base type double with unknown upper bounds:
typedef struct emxArray_real_T { double *data; //<<<<<<<<<<<<<<< RIGHT HERE int *size; int allocatedSize; int numDimensions; boolean_T canFreeData; } emxArray_real_T;
The predefined type corresponding to double is real_T. For more information on the correspondence between built-in data types and predefined types in rtwtypes.h
Upvotes: 1