~ubuntu-branches/ubuntu/hoary/scilab/hoary

« back to all changes in this revision

Viewing changes to man/fileio/read.man

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2005-01-09 22:58:21 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20050109225821-473xr8vhgugxxx5j
Tags: 3.0-12
changed configure.in to build scilab's own malloc.o, closes: #255869

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
.TH read 1 "April 1993" "Scilab Group" "Scilab Function"
2
 
.so ../sci.an
3
 
.SH NAME
4
 
read - matrices read
5
 
.SH CALLING SEQUENCE
6
 
.nf
7
 
[x]=read(file-desc,m,n,[format])   
8
 
[x]=read(file-desc,m,n,k,format)
9
 
.fi
10
 
.SH PARAMETERS
11
 
.TP 10
12
 
file-desc
13
 
: character string specifying the file name or integer value
14
 
specifying logical unit (see file).
15
 
.TP 10
16
 
m, n
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.
19
 
.TP 10
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
23
 
edition modes. 
24
 
.TP 10
25
 
k
26
 
: integer or vector of integer
27
 
.SH DESCRIPTION
28
 
reads row after row
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.
34
 
.LP
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).
38
 
.LP
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. 
42
 
 
43
 
.LP
44
 
Examples for \fVformat\fR: 
45
 
.nf 
46
 
(1x,e10.3,5x,3(f3.0))
47
 
(10x,a20) 
48
 
.LP 
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.
52
 
 
53
 
.LP
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.
57
 
.LP
58
 
To read on the keyboard use \fVread(%io(1),...)\fR.
59
 
.SH REMARK
60
 
Last line of data files must be terminated by a newline to be taken
61
 
into account.
62
 
.SH EXAMPLE
63
 
.nf
64
 
if MSDOS then unix('del foo');
65
 
else unix('rm -f foo'); end
66
 
A=rand(3,5); write('foo',A);
67
 
B=read('foo',3,5)
68
 
B=read('foo',-1,5)
69
 
read(%io(1),1,1,'(a)')  // waits for user's input
70
 
.fi
71
 
.SH SEE ALSO
72
 
file, readb, write, x_dialog, mscanf, mfscanf, msscanf, fscanfMat