read(1)

NAME
read - matrices read

CALLING SEQUENCE
[x]=read(file-name,m,n,[format])
[x]=read(file-name,m,n,k,format)

PARAMETERS

file-name
    : string or integer (logical unit number)

m, n
    : integers (dimensions of the matrix x). Set m=-1 if you dont know the numbers of rows, so the whole file is read.

format
    : string (fortran format). If format='(a)' then read reads a vector of strings n must be equal to 1.

k   : integer

DESCRIPTION
reads row after row the mxn matrix x (n=1 for character chain) in the file file-name (string or integer).

Two examples for format are : (1x,e10.3,5x,3(f3.0)),(10x,a20) ( the default value is *).

The type of the result will depend on the specified form. If form is numeric (d,e,f,g) the matrix will be a scalar matrix and if form contains the character a the matrix will be a matrix of character strings.

A direct access file can be used if using the parameter k which is is the vector of record numbers to be read (one record per row), thus m must be m=prod(size(k)).

To read on the keyboard use read(%io(1),...).

EXAMPLE
A=rand(3,5); write('foo',A);
B=read('foo',3,5)
B=read('foo',-1,5)
read(%io(1),1,1,'(a)')  // waits for user's input

SEE ALSO
file, readb, write, %io, x_dialog