File: writecommand.htm

package info (click to toggle)
extrema 4.3.6-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 19,212 kB
  • ctags: 6,452
  • sloc: cpp: 86,428; sh: 8,229; makefile: 814
file content (85 lines) | stat: -rw-r--r-- 3,055 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<HTML>
<HEAD>
<TITLE>WRITE command</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">

<P><font size="+3" color="green"><B>WRITE command</B></font></P>

<TABLE border="1" cols="2" frame="box" rules="all" width="572">
<TR>
<TD width="15%" valign="top"><B>Syntax</B>:</TD>
<TD width="85%" valign="top"><CODE>
WRITE file x1 { x2 ... }<br />
WRITE\SCALAR file s1 { s2 ... }<br />
WRITE\MATRIX file matrix<br />
WRITE\TEXT file txtvar</CODE>
</TD></TR>
<TR>
<TD width="15%" valign="top"><B>Qualifiers</B>:</TD>
<TD width="85%" valign="top"><CODE>
\SCALAR, \MATRIX, \TEXT, \APPEND</CODE>
</TD></TR>
<TR>
<TD width="15%" valign="top"><B>Examples</B>:</TD>
<TD width="85%" valign="top"><CODE>
WRITE FILE.DAT X Y Z<br />
WRITE\APPEND FILE.DAT X Y Z<br />
WRITE\SCALAR FILE.DAT A B C<br />
WRITE\SCALAR\APPEND FILE.DAT A B C<br />
WRITE\MATRIX\APPEND FILE.DAT M[1:100,1:10]<br />
WRITE\TEXT FILE.DAT `X['//RCHAR(J)//`] = '//RCHAR(X[J])<br />
WRITE\TEXT\APPEND FILE.DAT `A = '//RCHAR(A)</CODE>
</TD></TR>
</TABLE>
<P>
 The <CODE>WRITE</CODE> command is a general purpose writing
 command for vectors, scalars, matrices, or character strings. The variable type that will
 be written depends on the qualifier appended to the command. The parameters that are
 expected also depend on this qualifier.</p>
<p>
 <font size="+1" color="green">Write vectors</font></p>
<p>
 By default, the <CODE>WRITE</CODE> command writes vectors to a
 file. If the <CODE>\APPEND</CODE> qualifier is used, and if the
 output file already exists, the data will be appended onto the end of the file. Columns of
 data will be written to the file, where the <CODE>I</CODE><sup>th</sup> column will be
 vector <CODE>xI</CODE>. The number of lines that are written to the file will
 be the minimum length of the vectors. A maximum of <CODE>29</CODE> vectors can be written
 with one <CODE>WRITE</CODE> command.</p>
<p>
 <font size="+1" color="green">Example 1</font></p>
<p>
 If you have a vector, for example, <CODE>X</CODE>, and enter
 <CODE><font color="blue">WRITE FILE.DAT X X X</font></CODE>
 then the following values will be written to the file:</p>
<p>
 <pre>
 X(1) X(2) X(3)
 X(4) X(5) X(6)
 ...
 </pre></p>
<p>
 <font size="+1" color="green">Example 2</font></p>
<p>
 To write the vectors <CODE>X</CODE>, <CODE>Y</CODE> and <CODE>Z</CODE> to the file
 <CODE>DUM.DAT</CODE> so that there will be three columns of numbers in the file, enter:
 <CODE><font color="blue">WRITE DUM.DAT X Y Z</font></CODE></p>
<p>
 If you enter:
 <CODE><font color="blue">WRITE DUM.DAT X X Y Y Z Z</font></CODE>
 then the following will be written to the file:</p>
<p>
 <pre>
    X(1) X(2) Y(1) Y(2) Z(1) Z(2)
    X(3) X(4) Y(3) Y(4) Z(3) Z(4)
    X(5) X(6) Y(5) Y(6) Z(5) Z(6)
    ...  ...  ...  ...  ...  ...
 </pre></p>
<P>
 <a href="scalars.htm"><font size="+1" color="olive">Write scalars</font></a><br />
 <a href="matrix.htm"><font size="+1" color="olive">Write a matrix</font></a><br />
 <a href="text.htm"><font size="+1" color="olive">Write a character string</font></a>
</P>
</BODY>
</HTML>