matio-examples icon indicating copy to clipboard operation
matio-examples copied to clipboard

index must be 0 ~ p-1

Open bbyuan3 opened this issue 5 years ago • 1 comments

图片 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

bbyuan3 avatar Nov 18 '19 03:11 bbyuan3

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.

NJannasch avatar Nov 18 '19 04:11 NJannasch