I modified the sample program from section 2.3.1, Writing numeric arrays, of the documentation to write int64_t (MAT_T_INT64) to a file. Upon reading the file from Octave, I get the error:
error: load: reading imaginary matrix data for 'z'
Is anyone else having this problem? Is this just a problem with Octave?
Last edit: John Cognetti 2016-07-26
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Sorry for the delay. Here's the source code, a screenshot of the error from Octave, and the mat file that was produced by the code.
#include<stdlib.h>#include<stdio.h>#include"matio.h"#include<stdint.h>intmain(intargc,char**argv){mat_t*matfp;matvar_t*matvar;size_tdims[2]={10,1};int64_tx[10]={1,2,3,4,5,6,7,8,9,10},y[10]={11,12,13,14,15,16,17,18,19,20};structmat_complex_split_tz={x,y};matfp=Mat_CreateVer("test.mat",NULL,MAT_FT_DEFAULT);if(NULL==matfp){fprintf(stderr,"Error creating MAT file \"test.mat\"\n");returnEXIT_FAILURE;}matvar=Mat_VarCreate("x",MAT_C_INT64,MAT_T_INT64,2,dims,x,0);if(NULL==matvar){fprintf(stderr,"Error creating variable for 'x'\n");}else{Mat_VarWrite(matfp,matvar,MAT_COMPRESSION_NONE);Mat_VarFree(matvar);}matvar=Mat_VarCreate("y",MAT_C_INT64,MAT_T_INT64,2,dims,y,0);if(NULL==matvar){fprintf(stderr,"Error creating variable for 'y'\n");}else{Mat_VarWrite(matfp,matvar,MAT_COMPRESSION_NONE);Mat_VarFree(matvar);}matvar=Mat_VarCreate("z",MAT_C_INT64,MAT_T_INT64,2,dims,&z,MAT_F_COMPLEX);if(NULL==matvar){fprintf(stderr,"Error creating variable for 'z'\n");}else{Mat_VarWrite(matfp,matvar,MAT_COMPRESSION_NONE);Mat_VarFree(matvar);}Mat_Close(matfp);returnEXIT_SUCCESS;}
Well, test.mat is a valid v5 MAT file that both MATLAB and matio/matdump 1.5.8 are able to load/read. I am afraid you need to ask Octave developers why it cannot be read. It is likely that Octave links to an outdated libmatio which could not read such complex int64 arrays.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I modified the sample program from section 2.3.1, Writing numeric arrays, of the documentation to write int64_t (MAT_T_INT64) to a file. Upon reading the file from Octave, I get the error:
Is anyone else having this problem? Is this just a problem with Octave?
Last edit: John Cognetti 2016-07-26
Can you please attach the created MAT file and the modified sample code here. Thanks.
Sorry, cannot reproduce.
Sorry for the delay. Here's the source code, a screenshot of the error from Octave, and the mat file that was produced by the code.
Last edit: John Cognetti 2016-08-02
Well, test.mat is a valid v5 MAT file that both MATLAB and matio/matdump 1.5.8 are able to load/read. I am afraid you need to ask Octave developers why it cannot be read. It is likely that Octave links to an outdated libmatio which could not read such complex int64 arrays.
Will do, thanks for the help. :-)
Any news from the Octave team?