Hi Sylvestre! You wrote:
> It is not an octave bug. I just tried with Scilab and it causes a
> problem with Scilab too.
Ah! Here's a bit more concise test case, which write only 1 integer:
#include <matio.h>
int main()
{
mat_t * mat = Mat_Open( "foo.mat", 0 );
if ( mat==NULL ) abort();
int dims[2] = {1,1};
int i = 42;
matvar_t * matvar = Mat_VarCreate( "test", MAT_C_INT16, MAT_T_INT16,
2, dims, &i, 0 );
#if 1
/* writes broken file */
Mat_VarWrite( mat, matvar, COMPRESSION_ZLIB );
#else
/* writes working file */
Mat_VarWrite( mat, matvar, 0 );
#endif
Mat_Close( mat );
return 0;
}
Attached are the output file from this program (foo.mat) and the fiel as
matlab itself saves it, generated by:
> load('foo.mat');
> save('foo_matlab.mat','test')
in Matlab 2009b.
Note that the file are 1 byte different in length.
Hope this helps!
Kind regards,
Bas.
foo.mat
Description: Binary data
foo_matlab.mat
Description: Binary data

