Hello:
I'm looking to write a class instance via Matlab and read it back from a C++ program. Writing the file from Matlab, opening it in C++, and identifying the type of class all work for me. Reading the class properties does not work.
The screenshot says it all:
In Matlab (editor and command window shown at far left):
- I defined a class simple with three scalar properties
- I instantiated the class and wrote it to file
In VS2013 (source editor at center right, debugger console window at top right):
- I opened the file via C++ console application using matOpen (not visible in the source editor, but did succeed)
- I called matGetDir to enumerate the variable names
- I looped over the variables, calling matGetVariable on each one
- I checked the name to confirm that we found an instance of "simple", visible in the DOS window at upper right in the screenshot
- I find zero elements, zero fields, and 2 dimensions. This doesn't sound good.
- mxIsClass verifies that the mxArray holds an instance of simple.
- mxIsEmpty returns true. This doesn't sound good either.
- I start looking for properties via mxGetProperty, checking variants that might work. None are found.
Somewhere here I've got a fundamental misconception. Does anyone have a suggestion?
Many thanks
Matthew