Hi guys, I am trying to use shared library produced from C code. My purpose is send address of struct_1 to C function as an input, then change values in struct_1 in C function and take back address of struct_1 from C function to the MATLAB.
I have a structure such as struct_1 = struct('Var_1', var_1, 'Var_2', [var_2,var_2], 'Var_3', char(zeros(1,10))). I constructed this struct in MATLAB and same struct constructed also in C header file. Type of Var_1 is structure and type of Var_2 is 1x2 array which has a struct component. Additionally, Var_3 is a character array. I defined var_1 and var_2 structures before construct struct_1.
When I used ' calllib('libStruct', 'structFnc', struct_1); ', I took 'Cannot convert data value for field Var2 due to error: Array must be numeric or logical or a pointer to one' error.
I tried 'struct_1.Var_2 = libpointer('cstring');' but Var_2 variable become a 1x1 libpointer, actually it was a struct array. I took same error for char array variable, Var_3.
How can I use structure which is constructed with struct array and char array members in calllib function? I would be very glad if you help!