help-octave
[Top][All Lists]
Advanced

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

Re: Octave and gzipped files


From: Dmitri A. Sergatskov
Subject: Re: Octave and gzipped files
Date: Mon, 8 Jan 2007 16:04:31 -0700

On 1/8/07, Geordie McBain <address@hidden> wrote:
On Mon, 2007-01-08 at 22:16 +0000, Joseph Wakeling wrote:
> Is it possible for Octave to read data from gzipped ascii files?
>
> I'm having to deal with some rather large data files from simulations
> and it would be convenient to gzip them---it reduces their size by
> anything from 65-70%.
>
> If Octave can't directly read the gzipped file I suppose an alternative
> would be for Octave to call gzip to temporarily unzip the file, read the
> data, and then zip it back up again.  Is this possible?

Hello.  My Octave (2.9.9 on Debian etch) can save gzipped ascii files;
e.g.

  octave> save -ascii -z A.gz A

and load them again too (automatically detecting the need for
gunzipping):

  octave> load A.gz

--
Geordie McBain
www.aeromech.usyd.edu.au/~mcbain


And you can read gzipped files with C - style file i/o commands
(fopen, fscanf, etc).
See "help fopen" for details, here is an excerpt:

<<<
    Additionally, you may append a "z" to the mode string to open a
    gzipped file for reading or writing.  For this to be successful,
    you must also open the file in binary mode.


Sincerely,

Dmitri.
--


reply via email to

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