home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Tools / Languages / RLaB 1.15c / help / readm < prev    next >
Encoding:
Text File  |  1994-09-28  |  1.7 KB  |  52 lines  |  [TEXT/RLAB]

  1. readm:
  2.  
  3. Syntax:    readm ( "filename" )
  4.     readm ( "filename" , ROW_SIZE )
  5.  
  6. Description:
  7.  
  8.     Readm reads a generic matrix of data from the file denoted by
  9.     the argument. The return value is the newly created matrix.
  10.  
  11.     The file format is generic ASCII. The rows of the matrix are
  12.     separated by newlines, and the columns are separated by
  13.     whitespace. Unnecessary newlines, either before, or after the
  14.     data will confuse readm, and will probably result in an error
  15.     message. Only one matrix can be stored in a file. If you need
  16.     to store more than one matrix in a file, use write(), and
  17.     read(). 
  18.  
  19.     Readm can only read in numeric matrices. The result of reading
  20.     in string matrices is undefined.
  21.  
  22.     Example:
  23.  
  24.     1 2 3 4
  25.     5 6 7 8
  26.     9 10 11 12
  27.  
  28.     The above values in a file called "test" would be read in like:
  29.  
  30.     > a = readm("test")
  31.      a =
  32.      matrix columns 1 thru 4
  33.             1          2          3          4  
  34.             5          6          7          8  
  35.             9         10         11         12  
  36.  
  37.     Readm exists to read in data from other programs. In many
  38.     cases a simple awk script will filter the other programs
  39.     output into one or more columns of data. readm() will read the
  40.     data into the matrix, then the matrix can be reshaped if
  41.     necessary.
  42.  
  43.     Readm has no idea how many rows are in the matrix it is
  44.     reading. This is because readm can work with pipes and process
  45.     output where it gets the matrix as a stream. Readm uses a
  46.     heuristic to guess how many rows of the matrix to allocate at
  47.     one time. A second, optional argument, ROW_SIZE can be
  48.     specified if the heuristic does not yield the performance you
  49.     desire. The heuristic is purposely memory conservative.
  50.  
  51. See Also: reshape, getline, open, read, readb, write, writeb, writem
  52.