help-octave
[Top][All Lists]
Advanced

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

Re: More save/load questions


From: David Bateman
Subject: Re: More save/load questions
Date: Wed, 01 Jun 2005 17:13:33 +0200
User-agent: Mozilla Thunderbird 0.8 (X11/20040923)

SITI HAJAR A BAKAR wrote:

Hi all,
Just been going through all the mailing list questions on loading and saving in Octave. I'm running Octave 2.1.70 via Cygwin from X11 on Windows. AM afraid have confused myself, and would appreciate some clarification on the following

1) If I were to create a variable u=randn(1,20). Setting default_save_format='-text' or default_save_format='text'. I tried to save this data to a text file for example

If you are using a 2.1.x release then the variable and its format is

default_save_format="text"

if you are using the latest 2.9.x releases (with zlib support), then this variable is replaced with

default_save_options="-text"

save u, does not work. save 'u.txt' or any other variation in between did not work.
save u should save the variable u under the filename name u. The other variants are define a filename and save all user variables to it... Both work under 2.9.3 under linux for me..

Only when I created an empty .txt file named 'u' and saved it in my workpath and then

save (file_in_loadpath('u.txt'))   worked. If not I get

error: save : couldnt open output file 'u.txt' . Any explanations for this?
The open mode is

std::ios::openmode mode = std::ios::out | std::ios::ate : std::ios::trunc;

and so there is no reason to require that std::ofstream constructor requires that the file exists... This seems to be an issue with cygwin.

2) Upon loading the above saved file u.txt , load (file_in_loadpath
('u.txt'))
I get a bunch of errors which it wont read. Now correct me if I'm wrong, but my file lacks some headers which Octave requires to read the file. Is that so?

Can't say you didn't send the error messages..

3) I achieve what i want by setting  default_save_format='-binary'
I then create an empty file named 'u'. Then save the data I want to save to 'u.txt' and the only did it read it back.

You moved a binary file to a text file and octave recognized it as a binary file. Octave doesn't care about the extensions..

4) I'm trying to maintain a toolbox which would run on MATLAB and Octave. WOuld there be any disadvantages to setting the default_save_format to "binary" ??

Why not set it to "mat-binary" in this case


Thanks guys!



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



--
David Bateman                                address@hidden
Motorola Labs - Paris +33 1 69 35 48 04 (Ph) Parc Les Algorithmes, Commune de St Aubin +33 1 69 35 77 01 (Fax) 91193 Gif-Sur-Yvette FRANCE

The information contained in this communication has been classified as: [x] General Business Information [ ] Motorola Internal Use Only [ ] Motorola Confidential Proprietary



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