MATLAB: Interpreting a struct returned by engGetVariable

enggetvariableMATLABsturct

Hi,
I am adapting matlab code to run from C++ through the matlab engine and I need to retrieve and put a struct which contains scalars, strings and matrices…
How do I navigate through the struct (returned in an mxArray) once I have it and accordingly how do i put info into various sections?
Is it even possible to manipulate a struct variable once returned?
Thanks, Sean

Best Answer

You should be able to use mx* struct functions to manipulate and traverse your structure.
bool mxIsStruct(const mxArray *pm)
for example lets you test whether the mxArray is a structure.
Look at the phonebook.c example in MATLABROOT/extern/examples/refbook/