3 files.ct

Contents of this section

This section describes functions from file files.ct.

3.1 export_matlab

[] = export_matlab(fn...)
 export_matlab("file") saves all variables in Tela
   workspace in "file". Any previous contents of "file"
   are overwritten. The data are written in MATLAB
   binary format.

   export_matlab("file","var1","var2"...) saves only the
   specified variables. Notice that you have to give the
   variable names as strings.

   The resulting MAT-file can be read using the
   MATLAB 'load' command.
   
   Limitations (bugs): It is not possible to export
   local variables. If you try, the global ones will
   be written, if they have numeric values. Use
   export_matlab2 to achieve this, and to have explicit
   control of variable naming.
   
See also:
export_matlab2 , save , load , import .
   Error codes:
   1: Too few arguments
   2: Argument not a string
   3: Write error on file
   

3.2 export_matlab2

[] = export_matlab2(fn...)
 export_matlab2("file", var1,"name1", var2,"name2"...)
   saves objects var1,var2... in MATLAB binary format in "file".
   The objects will be named "name1", "name2"... .
   Any previous contents of "file" are overwritten.
   workspace in "file". Any previous contents of "file"
   is overwritten.

   The resulting MAT-file can be read using the
   MATLAB 'load' command.
   
See also:
export_matlab , save , load , import .
   Error codes:
   1: First arg not a string
   2: Even number of arguments
   3: Write error on file
   4: The 'name' argument is not a string
   

3.3 import

[] = import(filename)
 import("file") tries to load the contents of "file" in Tela workspace.
   All files accepted by load are also accepted by import. In addition,
   import accepts more general HDF files and MATLAB binary files.
   Create these files using the MATLAB 'save' command.

   Restrictions:
   1) Only MATLAB files created on a similar architecture can be
   correctly imported. If this rule is not followed, the imported
   data will be garbage!
   2) MATLAB4.0 and higher saves arrays with more than 10000 elements
   as various integer formats, if all elements are whole numbers.
   Tela cannot read these files. A workaround is to perturb one element
   in MATLAB before saving so that it is not exactly integer.

   For filename conventions, see load.
See also:
load , save , import1 , export_matlab .

   (The difference between import and import1 is that import1 reads
    only one object and returns it, whereas import reads several
        objects and assigns them directly to workspace variables.)
   Error codes:
   1: Argument not string or char
   2: Argument is not an HDF file
   3: File not found
   4: Cannot import file
   5: Unused error message
   6: Cannot import this Matlab file (O(letter'Oh) != 0, (can even Matlab?))
   7: Cannot import this Matlab file (P != 0). Is your array size >10000 and all integer? Try perturbing it
   8: Cannot import this Matlab file (T != 0, 1). Is it a sparse matrix? Make it full
   10: Bad Matlab binary file, premature end of file
   

3.4 import1

[x] = import1(filename; label)
 import1("file") reads one object from "file". The imported
   object is returned. "File" can be one of the following:

   1) HDF file, in which case the first Scientific Data Set (SDS)
      is imported. The form import1("file.hdf","label") reads SDS
      with label "label", which is not necessarily the first one.

   2) D-style ASCII file of the following format:

        (line 1)   D=Nt dim1 dim2 ... dimN
        (any number M of blank lines or lines starting with '#')
        (line M+2) data1 data2 ....

       where N is the rank of the dataset and t is an optionial
       type specification letter: t may be either 'r', 'i', or 'c'
       for real, integer and complex data, respectively. If t is
       missing, real data are asssumed.

   3) Plain ASCII file of nrows x ncols real numbers. If nrows or
      ncols is 1, it will be returned as a vector, otherwise as a
      matrix. Missing entries are treated as zeros. This format
      is similar to Matlab's load for ASCII, except that '#'
      comments are accepted in the beginning.
       
See also:
import , load , save .
   See import for a difference between import and import1.
   For filename conventions, see load.
   Error codes:
   -1: Input arg not a char or string
   -2: File not found
   -3: Unknown format in ASCII file
   -4: Unknown format in ASCII file
   -5: Too high rank ASCII data
   -6: Syntax error in ASCII file dimension specification
   -7: Syntax error when reading D-style ASCII data
   -8: Internal error
   -9: Cannot import file
   -10: Second arg not a string
   -11: Specified label not found
   -12: Premature end of file in D-style ASCII
   -13: Syntax error when reading plain ASCII data
   

3.5 load

[] = load(filename)
 load("file") loads the contents of "file"
   in Tela workspace.
   "file" must have been previously created using
   the 'save' command; it must be in a certain
   HDF format.

   Filename conventions:
   If the filename starts with "/", "./" or "..",
   it is considered absolute. Otherwise it is searched
   along TELAPATH. This applies to other file
   operations as well.
   
   The counterpart of load is save.
   To read more general HDF files and ASCII files,
   see import1.
   To load more general HDF files and MATLAB binary
   files, see import.
See also:
save , import , import1 , export_matlab .
   Error codes:
   1: Argument not string or char
   2: Argument is not an HDF file
   3: File not found
   

3.6 save

[] = save(fn...)
 save("file") saves all variables in Tela workspace
   in "file". Any previous contents of "file" is
   overwritten. The data are written as Scientific
   Data Sets in HDF format.
   save("file","var1","var2"...) saves only the
   specified variables. Notice that you have to give
   the variable names as strings.

   Limitations (bugs): It is not possible to save
   local variables, since they are not bound to
   symbols. If you try, the global one, if any,
   will be saved.
   
See also:
load , export_matlab .
   Error codes:
   1: Too few arguments
   2: Argument not a string or char
   3: Unexpected HDF error
   

Next Chapter, Previous Chapter

Table of contents of this chapter, General table of contents

Top of the document,