help-octave
[Top][All Lists]
Advanced

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

Re: Save-load problem


From: Pablo Barrera González
Subject: Re: Save-load problem
Date: 29 Apr 2003 19:24:42 +0200

El mar, 29-04-2003 a las 19:05, Henry F. Mollet escribió:
> I've tried an introductory example in an MATLAB textbook and used Octave to
> check. Saving and reloading is changing the size of A. Why and how would I
> avoid this problem?
> Henry
> 

This error it's due to the way how octave save ascii files. In order to
save space (I guess) in your example:
> GNU Octave, version 2.1.35 (powerpc-apple-darwin6.2).
> Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 John W. Eaton.
> 
> octave:1> A = 0:pi/16:8*pi;
> octave:2> whos
> 
> *** local user variables:
> 
> prot  type                       rows   cols  name
> ====  ====                       ====   ====  ====
>  rwd  range                         1    129  A
> 

Octave save this file:

# Created by Octave 2.0.16.92, Tue Apr 29 17:19:46 2003 <address@hidden>
# name: A
# type: range
# base, limit, increment
0 25.1327412287183 0.196349540849362

And it looses presition. 

In my machine I used save with the float-binary option:

address@hidden:/tmp$ octave2.0 
GNU Octave, version 2.0.16.92 (i386-pc-linux-gnu).
Copyright (C) 1996, 1997, 1998, 1999, 2000 John W. Eaton.
This is free software with ABSOLUTELY NO WARRANTY.
For details, type `warranty'.

octave2.0:1> A = 0:pi/16:8*pi;
octave2.0:2> whos

*** local user variables:

prot  type               rows   cols  name
====  ====               ====   ====  ====
 wd   range                 1    129  A

octave2.0:3> save -float-binary session3.mat
octave2.0:4> clear
octave2.0:5> whos
octave2.0:6> load session3.mat
octave2.0:7> whos

*** local user variables:

prot  type               rows   cols  name
====  ====               ====   ====  ====
 wd   range                 1    129  A


And it seems to work. I don't know how to force octave for saving the
entire list of values in ascii. 

HTH



-- 
----------------------------------------------------
Pablo Barrera González          address@hidden
        Universidad Carlos III de Madrid
        http://www.tsc.uc3m.es/~pbarrera
----------------------------------------------------




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