help-octave
[Top][All Lists]
Advanced

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

The save command?


From: John W. Eaton
Subject: The save command?
Date: Fri, 23 Mar 2007 14:02:18 -0400

On 23-Mar-2007, Steve C. Thompson wrote:

| I remember hearing people on this list talk about the save command and
| Matlab compatibility.  I used to issue,
| 
|   save -ascii 'result.dat' a_matrix_of_data
| 
| But now I'm using
| 
|   save -text 'result.dat' a_matrix_of_data
| 
| the only difference being -text versus -ascii.  I thought I remember
| folks (and Octave itself) saying -text is recommended for Matlab
| compatibility.  However, a friend of mine ran my code, that has the
| second command above, and Matlab returned in error.
| 
| I don't have a copy of Matlab.  Does anyone know what it wants and more
| importantly, does anyone know what I can do to better ensure
| compatibility in this area?

In Octave 2.1.73, -text and -ascii are the same:

  octave2.1:1> a = [1,2;3,4];
  octave2.1:2> save -text - a
  # Created by Octave 2.1.73, Fri Mar 23 14:00:05 2007 EDT <address@hidden>
  # name: a
  # type: matrix
  # rows: 2
  # columns: 2
   1 2
   3 4
  octave2.1:3> save -ascii - a
  warning: the meaning of this option will change in a future
  warning: version of Octave to be compatible with Matlab.
  warning: To keep the meaning of your code the same across
  warning: this change, use the -text option instead.
  # Created by Octave 2.1.73, Fri Mar 23 14:00:10 2007 EDT <address@hidden>
  # name: a
  # type: matrix
  # rows: 2
  # columns: 2
   1 2
   3 4

In 2.9.x, they are different, and I think -ascii is compatible with
Matlab:


  octave2.9:1> a = [1,2;3,4]
  a =

     1   2
     3   4

  octave2.9:2> save -text - a
  # Created by Octave 2.9.9, Fri Mar 23 14:01:45 2007 EDT <address@hidden>
  # name: a
  # type: matrix
  # rows: 2
  # columns: 2
   1 2
   3 4
  octave2.9:3> save -ascii - a
   1.00000000e+00 2.00000000e+00
   3.00000000e+00 4.00000000e+00

Does that help?

jwe


reply via email to

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