From bug-octave-request at bevo dot che dot wisc dot edu Thu Jan 29 16:10:59 1998 Subject: row/column major ordering problem From: Michael Hohn To: bug-octave at bevo dot che dot wisc dot edu CC: hohn at math dot utah dot edu Date: Thu, 29 Jan 1998 15:10:53 -0700 (MST) Hello, This is a problem I thought fixed a long time ago, but here it it again: I have a program writing files in matlab binary format, in either row or column major order: ./a.out Matrix: 2 by 2 row 0: 0.846186767 0.468314366 row 1: 0.236917463 0.65696803 In matlab: >> load foo.mat >> mat mat = 0.8462 0.4683 0.2369 0.6570 Octave, version 2.0.9 (sparc-sun-solaris2.5). octave:1> load foo.mat octave:2> mat mat = 0.84619 0.23692 0.46831 0.65697 Oops!! Apparently, the order flag is ignored... Fix: --- (from an old message): The first thing written to a matlab binary file should be a long int (4 bytes); it contains info of the form ... + 1000*?? + 100*ORDER + 10*?? + ... The ORDER flag is 0 for column major order, 1 for row major.