[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Some questions
Re: Some questions
Wed, 25 Apr 2001 23:02:34 +0200
On Wed, 25 Apr 2001 13:27:12 -0500, Howard Chandler wrote :
> At 6:34 PM +0300 4/25/01, Teemu Ikonen wrote:
> >On Wed, 25 Apr 2001, Howard Chandler wrote:
> >> Has anyone got open source for reading/writing matlab .mat (v 5+)
> files in
> >> c and FORTRAN?
> >I believe latest versions of octave (2.1.34) support matlab 5 files, so
> >yes, there exists free code.
> I'll have to dig into the source to find them then huh?
> Octave uses the same functions (save/load) ?
Yes with some difference (notably load : if the variable already exist
you have to clear it before or to load -force.)
Here are the help for the save and load in octave (2.1.33)
octave:1> help save
save is a built-in text function
- Command: save options file v1 v2 ...
Save the named variables V1, V2, ... in the file FILE. The
special filename `-' can be used to write the output to your
terminal. If no variable names are listed, Octave saves all the
variables in the current scope. Valid options for the `save'
command are listed in the following table. Options that modify
the output format override the format specified by the built-in
Save the data in Octave's text data format.
Save the data in Octave's binary data format.
Save the data in Octave's binary data format but only using
single precision. You should use this format only if you
know that all the values to be saved can be represented in
Save the data in MATLAB's binary data format.
Save the data in the binary format written by MATLAB version
Save the data in HDF5 format. (HDF5 is a free, portable
You should use this format only if you know that all the
values to be saved can be represented in single precision.
Force Octave to save the values of built-in variables too.
By default, Octave does not save built-in variables.
The list of variables to save may include wildcard patterns
containing the following special characters:
Match any single character.
Match zero or more characters.
`[ LIST ]'
Match the list of characters specified by LIST. If the first
character is `!' or `^', match all characters except those
specified by LIST. For example, the pattern `[a-zA-Z]' will
match all lower and upper case alphabetic characters.
Except when using the MATLAB binary data file format, saving global
variables also saves the global status of the variable, so that if
it is restored at a later time using `load', it will be restored
as a global variable.
save -binary data a b*
saves the variable `a' and all variables beginning with `b' to the
file `data' in Octave's binary format.
octave:2> help load
load is a built-in text function
- Command: load options file v1 v2 ...
Load the named variables from the file FILE. As with `save', you
may specify a list of variables and `load' will only extract those
variables with names that match. For example, to restore the
variables saved in the file `data', use the command
Octave will refuse to overwrite existing variables unless you use
the option `-force'.
If a variable that is not marked as global is loaded from a file
when a global symbol with the same name already exists, it is
loaded in the global symbol table. Also, if a variable is marked
as global in a file and a local symbol exists, the local symbol is
moved to the global symbol table and given the value from the
file. Since it seems that both of these cases are likely to be
the result of some sort of error, they will generate warnings.
If invoked with a single output argument, Octave returns data
instead of inserting variables in the symbol table. If the data
file contains only numbers (TAB- or space-delimited columns), a
matrix of values is returned. Otherwise, `load' returns a
structure with members corresponding to the names of the
variables in the file.
The `load' command can read data stored in Octave's text and
binary formats, and MATLAB's binary format. It will automatically
detect the type of file and do conversion from different floating
point formats (currently only IEEE big and little endian, though
other formats may added in the future).
Valid options for `load' are listed in the following table.
Force variables currently in memory to be overwritten by
variables with the same name found in the file.
Force Octave to assume the file is in Octave's text format.
Force Octave to assume the file is in Octave's binary format.
Force Octave to assume the file is in MATLAB's binary format.
Force Octave to assume the file is in the binary format
written by MATLAB version 4.
Force Octave to assume the file is in HDF5 format. (HDF5 is
a free, portable binary format developed by the National
Center for Supercomputing Applications at the University of
Illinois.) Note that Octave can read HDF5 files not created
by itself, but may skip some datasets in formats that it
cannot support. In particular, it will skip datasets of data
types that it does not recognize, with dimensionality > 2, or
with names that aren't valid Octave identifiers See, however,
the `-import' option to ameliorate this somewhat.
Make a stronger attempt to import foreign datasets.
Currently, this means that for HDF5 files, invalid characters
in names are converted to `_', and datasets with
dimensionality > 2 are imported as lists of matrices (or
lists of lists of matrices, or ...).
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