1
.TH read 1 "April 1993" "Scilab Group" "Scilab Function"
7
[x]=read(file-desc,m,n,[format])
8
[x]=read(file-desc,m,n,k,format)
13
: character string specifying the file name or integer value
14
specifying logical unit (see file).
17
: integers (dimensions of the matrix x). Set m=-1 if you do not know the
18
numbers of rows, so the whole file is read.
20
format : character string, specifies a "Fortran" format. This
21
character string must begin with a right parenthesis and end with a
22
left parenthesis. Formats cannot mix floating point or character
26
: integer or vector of integer
29
the \fVmxn\fR matrix \fVx\fR (\fVn=1\fR for character chain) in the
30
file \fVfile-desc\fR (string or integer). Each row of the matrix \fVx\fR
31
begin in a new line of \fVfile-desc\fR file. Depending on \fVformat\fR, a
32
given row of the \fVx\fR matrix may be read from more than one line
33
of \fVfile-desc\fR file.
35
The type of the result will depend on the specified format.
36
If format contains only \fV(d,e,f,g)\fR descriptors the function
37
tries to read numerical data (the result is matrix of real numbers).
39
If format contains only \fVa\fR descriptors the function tries to
40
read character strings (the result is a character string column
41
vector). In this case n must be equal to 1.
44
Examples for \fVformat\fR:
49
When format is omitted datas are read using numerical free format:
50
blank, comma and slash may be used as data separators, n*v may be use
51
to represent n occurrences of value n.
54
A direct access file can be used if using the parameter \fVk\fR which is
55
is the vector of record numbers to be read (one record per row),
56
thus \fVm\fR must be \fVm=prod(size(k))\fR.
58
To read on the keyboard use \fVread(%io(1),...)\fR.
60
Last line of data files must be terminated by a newline to be taken
64
if MSDOS then unix('del foo');
65
else unix('rm -f foo'); end
66
A=rand(3,5); write('foo',A);
69
read(%io(1),1,1,'(a)') // waits for user's input
72
file, readb, write, x_dialog, mscanf, mfscanf, msscanf, fscanfMat