matio-examples
matio-examples copied to clipboard
index must be 0 ~ p-1
I tested your code
matvar_t* matstruct1 = Mat_VarCreateStruct(mystring0, 2, structdim1, Datafieldnames, 3);
//Set Test(p).Data (1 <= p <= n)
Mat_VarSetStructFieldByName(matstruct0, fieldnames[0], 0, matstruct1);
Mat_VarWrite(matfp, matstruct0, MAT_COMPRESSION_NONE);
here p must be 0~n-1
The comment refers to the Matlab notation which starts with 1.
But you are right, in c++ we're starting with 0. Feel free to create a pull request with a change.