Note that you get a warning, not an error. However, the warning is correct in that it's not possible to fill that structure in matlab. You then get an error if you try something like:
cstr = libstruct('a', 1, 'b', 2, 'chrArray', repmat({'aaaa'}, 1 , 6));
which is valid according to the structure definition but matlab errors telling you that "Only Structure arrays of simple data types are supported".
A simple workaround would be to split your array of char pointers into its 6 individual elements resulting in 6 fields:
typedef struct
{
double a;
double b;
char *chrArray_1;
char *chrArray_2;
char *chrArray_3;
char *chrArray_4;
char *chrArray_5;
char *chrArray_6;
}
It's been a while since I coded in C, but I believe that since the fields are all going to be pointers they will be contiguous so have the same memory layout of the array, so from the point of view of the compiled dll the 2 structures are the same.
0 Comments
Sign in to comment.