help-octave
[Top][All Lists]
Advanced

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

Re: save function


From: John W. Eaton
Subject: Re: save function
Date: Wed, 9 Mar 2005 22:27:18 -0500

On  9-Mar-2005, Mike Miller <address@hidden> wrote:

| I assume that the problem for MATLAB is that it doesn't read in anything 
| but numbers from a text file.  Thus, it must convert character strings to 
| numerical representations (using ascii character numbers, I think) before 
| saving.  To store complex numbers, you need a way to represent pairs - 
| Octave uses parentheses and commas, but MATLAB (apparently) can't read in 
| parentheses and commas.

I think the difficulty is that you have to do more work to decide
whether the to-be-read data are complex or just real (yes, you can
check for things that look like "(X,Y)" but it is more work).  And
obviously there is no way to know that

 1.0200000e+02   1.1100000e+02   1.1100000e+02   9.8000000e+01   9.7000000e+01  
 1.1400000e+02

is actually supposed to be read back in as 'foobar'.
  
| What can ya do?  I think this is a good place to limit compatibility.

Sure, that's fine, because it makes no sense to rely on this "feature"
to save character strings or to save the real part of a complex number
when you can just as easily do

  f = fopen (file, 'w');
  fprintf (f, '%s', 'foobar');
  fclose (f);

or

  save (file, real (z));

instead and get predictable results and no warning.

jwe



-------------------------------------------------------------
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
-------------------------------------------------------------



reply via email to

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