From help-request at octave dot org Tue Mar 8 10:02:35 2005 Subject: Re: save function From: Hamish Allan To: "John W. Eaton" Cc: Help-Octave List , brumen@hispeed.ch, Mike Miller , Paul Kienzle Date: Tue, 8 Mar 2005 09:41:27 -0600 On Mar 8, 2005, at 15:16, John W. Eaton wrote: > I don't think we want -ascii2 to mean "do the Matlab-compatible -ascii > thing" because it just trades one incompatibility for another. If we > want compatibility, then we have to make Octave's "save -ascii" do > what Matlab's does. That includes saving character strings as numeric > data and allowing multiple values to be stored in a single file (with > no header information that gives you a clue about what variables are > where -- I guess when saving the entire workspace, the variables are > stored in alphabetical order?) and so on. We can still keep Octave's > old -ascii behavior, but we will need rename the option. As I noted > in my previous message, this is likely to cause some pain. How can we > minimize it? How about the following behaviour: octave> a = [1 2 3]; octave> b = [4;5;6]; octave> save -ascii both a b octave> save -ascii just_a a octave> save -ascii just_b b octave> save -headed-ascii headed_a a $ cat both # Created by Octave 2.1.64, Tue Mar 08 15:36:56 2005 GMT # name: a # type: matrix # rows: 1 # columns: 3 1 2 3 # name: b # type: matrix # rows: 3 # columns: 1 4 5 6 $ cat just_a 1 2 3 $ cat just_b 4 5 6 $ cat headed_a # Created by Octave 2.1.64, Tue Mar 08 15:37:06 2005 GMT # name: a # type: matrix # rows: 1 # columns: 3 1 2 3 In contrast, Matlab exhibits the following behaviour: >> save -ascii both a b >> load -ascii both ??? Error using ==> load Number of columns on line 2 of ASCII file /Users/hamish/both must be the same as previous lines. $ cat both 1.0000000e+00 2.0000000e+00 3.0000000e+00 4.0000000e+00 5.0000000e+00 6.0000000e+00 Best wishes, Hamish ------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.octave.org How to fund new projects: http://www.octave.org/funding.html Subscription information: http://www.octave.org/archive.html -------------------------------------------------------------