I am loading a C DLL into MATLAB using LOADLIBRARY to call a function that takes a nested structure as input.
The structure is defined as follows:
typedef struct { int one; int two; int three; } s_A; typedef struct { s_A a1; s_A a2; } s_B;
The function exported from the DLL is of the form:
void my_c_function(int *a, s_B *b);
which requires me to construct a structure of type s_B.
In MATLAB 7.8 (R2009a), when I create the structure, I use the following code:
matlab_struct = libstruct('s_B');matlab_struct.a1.one = 1;matlab_struct.a1.two = 2;matlab_struct.a1.three = 3;matlab_struct.a2.one = 4;matlab_struct.a2.two = 5;matlab_struct.a2.three = 6;
However, in MATLAB 7.10 (R2010a), the same code errors out at the line:
matlab_struct.a1.one = 1;
saying: ERROR: ??? A dot name structure assignment is illegal when the structure is empty. Use a subscript on the structure.
Best Answer