[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Endianness when transitioning to C#

From: Richardson, Anthony
Subject: RE: Endianness when transitioning to C#
Date: Tue, 2 Jul 2019 13:36:06 +0000

> From: Andreas Nessmann
> Subject: Endianness when transitioning to C#
> I am working with Octave 5.1.0, on a little-Endian machine (as told by the 
> computer() function). 
> However, when I save, say, a simple 2x3 matrix using 
> save 'filename' matrix  
> and use the MathNet-method MatlabReader to transport this file to C#, I get 
> the error message 'Big Endian files are not supported.' 
> Now, it is of course possible that there is an issue with that reader as 
> well, albeit I have used it successfully with Matlab in the past. However, 
> just to > > check, is there any possibility, or does anyone have experience 
> with an occurrence where .mat-files are saved in the 'wrong' endianness?
> Note that the error persists if I use swapbytes on my matrix A beforehand, as 
> then merely the entries in the saved file change. 

Octave saves in a text format by default, while MATLAB saves in a binary 
format.   I would guess that the MatlabReader method is not correctly 
interpreting the input file type.   You can save in a MATLAB compatible binary 
format using:

save -v7 'filename' matrix

Tony Richardson

reply via email to

[Prev in Thread] Current Thread [Next in Thread]