Loading Variables into Octave

Description

Loads variables from a file, a list or an environment.

Usage

o_load(from, ..., options)

Arguments

from
a list or an environment from where the objects should be loaded
...
names of the variables to load
options
argument passed to the Octave function load. See section Octave Documentation.

Octave Documentation for <em>load</em>

 -- Command: load file
 -- Command: load options file
 -- Command: load options file v1 v2 ...
 -- Command: S = load ("options", "file", "v1", "v2", ...)
 -- Command: load file options
 -- Command: load file options v1 v2 ...
 -- Command: S = load ("file", "options", "v1", "v2", ...)
     Load the named variables V1, V2, ..., from the file FILE.  If no
     variables are specified then all variables found in the file will
     be loaded.  As with 'save', the list of variables to extract can be
     full names or use a pattern syntax.  The format of the file is
     automatically detected but may be overridden by supplying the
     appropriate option.

     If load is invoked using the functional form

          load ("-option1", ..., "file", "v1", ...)

     then the OPTIONS, FILE, and variable name arguments (V1, ...) must
     be specified as character strings.

     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.

     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.  If compiled with zlib
     support, it can also load gzip-compressed files.  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 be added in the future).

     Valid options for 'load' are listed in the following table.

     '-force'
          This option is accepted for backward compatibility but is
          ignored.  Octave now overwrites variables currently in memory
          with those of the same name found in the file.

     '-ascii'
          Force Octave to assume the file contains columns of numbers in
          text format without any header or other information.  Data in
          the file will be loaded as a single numeric matrix with the
          name of the variable derived from the name of the file.

     '-binary'
          Force Octave to assume the file is in Octave's binary format.

     '-hdf5'
          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.  This format is only available if Octave was
          built with a link to the HDF5 libraries.

     '-import'
          This option is accepted for backward compatibility but is
          ignored.  Octave can now support multi-dimensional HDF data
          and automatically modifies variable names if they are invalid
          Octave identifiers.

     '-mat'
     '-mat-binary'
     '-6'
     '-v6'
     '-7'
     '-v7'
          Force Octave to assume the file is in MATLAB's version 6 or 7
          binary format.

     '-mat4-binary'
     '-4'
     '-v4'
     '-V4'
          Force Octave to assume the file is in the binary format
          written by MATLAB version 4.

     '-text'
          Force Octave to assume the file is in Octave's text format.

     See also: save, dlmwrite, csvwrite, fwrite

[Generated from Octave-3.6.4 on 2014-05-21 11:08:16 ]

Examples


## Don't show: 
# roxygen generated flag
options(R_CHECK_RUNNING_EXAMPLES_=TRUE)
## End Don't show

# Loading from a MATLAB/Octave file
#o_load

# Loading from an R list
o_clear()
l <- list(a=1, b=20, c=runif(10), d="this is a string", e=matrix(1:15, 3, 5))
o_load(l)

# Loading from an R environment
o_load( list2env(l) )

# Partial loading
o_clear()
o_load(l, a, b, c)
o_clear()
o_load(list2env(l), d, e)