|
WRITEName:
where <variable list> is a list of parameters, variables, strings, or matrices (separated by spaces); and where the <SUBSET/EXCEPT/FOR qualification> is optional.
where <file name> specifies the name of the output file; <variable list> is a list of parameters, variables, strings, or matrices (separated by spaces); and where the <SUBSET/EXCEPT/FOR qualification> is optional. If the file name does not contain a period, place a period (no spaces) at the end of the file name.
This syntax writes all currently defined variables (up to 25 variables may be printed). Although this command was implemented primarily for the Tcl/Tk graphical interface, it can also be used directly.
<SUBSET/EXCEPT/FOR qualification> where <file name> specifies the name of the output file; <HTML/LaTex/RTF> specifies that variables will be written HTML (HTML), LaTex (LaTex), or Rich Text Format (RTF) format; <variable list> is a list of variables; and where the <SUBSET/EXCEPT/FOR qualification> is optional. This syntax is used to write variables in either HTML, LaTex, or RTF format. It is restricted to variables only (i.e., no parameters, strings, or matrices). In addition, HTML format is limited to 15 variables and LaTex and RTF format are limited to 7 variables. LaTex and RTF have a fixed width pages which is why we currently restrict the number of columns. This option is useful when you want to display output for web pages or you want to import output into documents. The output from the WRITE comamnd will be generated as a "table".
<SUBSET/EXCEPT/FOR qualification> where <file name> specifies the name of the output file; <variable list> is a list of parameters, variables, strings, or matrices (separated by spaces); and where the <SUBSET/EXCEPT/FOR qualification> is optional. This syntax is similar to the standard WRITE command. However, there are some distinctions between how WRITE1, WRITE2, and WRITE3 work compared to WRITE. This is discussed in a Note section below.
WRITE DATA.SAVE X Y PRED RES WRITE X Y PRED RES
The precedence order is:
However, sometimes you may want to append the output of several WRITE commands to the same output file. The SET WRITE REWIND OFF command suppresses the automatic closing of the file after the WRITE command. So a typical sequence would be something like
WRITE FILE.OUT .... WRITE FILE.OUT .... WRITE FILE.OUT .... SET WRITE REWIND ON WRITE FILE.OUT " " We specify the final write (just a blank line) after the SET WRITE REWIND command in order to insure that the ouput file is closed. Note that Dataplot currently only uses a single unit number for the WRITE command. This means that if you use the SET WRITE REWIND OFF command, you should write to the same file until the SET WRITE REWIND comamnd has been entered and the current file has been closed (i.e., the final WRITE after the SET WRITE REWIND ON command). If you try to write to multiple output files after a SET WRITE REWIND OFF, the results may be unpredictable.
The one exception is that you can use the command
to write variables in an unformatted Fortran file. Note that this is not a portable format. Its primary use is to speed up the read time for large files that will be read many times on the same system. It is not appropriate for archiving data since Fortran unformatted files are compiler dependent.
The "Y1 TO Y8" will write variables Y1, Y2, Y3, Y4, Y5, Y6, Y7, and Y8.
You can also specify whether rule lines are drawn above and below the variable names in the output by entering the command
The default is ON. If the VARIABLE LABEL command has been used to define labels for the variables, these will be used instead of the variable names in the header line. These variable labels will be truncated if they are longer than the width of the field (variable labels can be 24 characters long while fields in the WRITE command are ofter set to 15 or less). If you want to suppress the variable names, enter the command
To restore the default of printing the variable names, enter
As a further caution for Unix hosts, certain expansion characters (specifically ~ to refer to your home directory) are interperted by the shell and are not recognized by the Fortran compiler. These expansion characters are interperted as literal characters and do not yield the intended file name.
If you specify a header file, the contents of that file will be added to the beginning of the file specified on the WRITE command.
To print row labels, use ROWLABEL as the variable name. This is demonstrated in the Program 2 and Program 3 examples below. The Program 2 example also shows how to print character fields as coded numeric variables while Program 3 prints the original character values. The Program 4 example demonstrates writing a group label variable.
The behavior of the WRITE command is:
There are two primary limitations for the WRITE command.
The following is an example of where these limitations may come into play. Suppose we are processing a list of files and performing a FIT to the variables in these files. We would like to save the residual and predicted values for each fit to a file. However, we would also like to save some summary information about each fit to another file. This was the situation that the WRITE1/WRITE2/WRITE3 commands are intended to address. Specifically, the behavior of WRITE1/WRITE2/WRITE3 is
The WRITE1, WRITE2, and WRITE3 units are treated independently of each other. That is, you can concurrently maintain append access to three distinct files while still using the WRITE command in the normal way. An example of using WRITE1 is given in the Program 5 example below.
will be interpreted as
If a single word command is entered, Dataplot first tries to process it as a command. If the command is successfully executed or it generates an error message, nothing further is done. However, if no match is found and no error is generated, Dataplot will prepend a WRITE to the command and re-process it. Specifically, R, REPEAT, X, S, SAVE, L, and LIST are valid commands without arguments. A number of other commands without arguments (e.g., NLIST or FIT) will generate an error. So, for example, if you have a variable called R you need to enter WRITE R rather than just R. This only applies to single word commands. Entering
will not be interpreted as
Setting this to ON will write the file as a comma separated values (CSV) file. This option in intended primarily for the case where you want to import the file into another program that expects ASCII files to be in CSV format.
WRITE ALL VARIABLES is a synonym for WRITE VARIABLES ALL.
1997/12: Implemented Syntax 3. 2003/09: Support for HTML and LaTex output. 2009/04: Support for RTF output. 2009/04: Maximum number of variables for the WRITE command increased to 1024. 2018/10: Support for writing group labels 2018/10: Support for writing row labels, character data 2018/12: Support for WRITE1, WRITE2, WRITE3 2019/12: Support for interpreting single word commands as implicit WRITE commands 2020/05: Support for SET WRITE CSV
LET Y1 = NORMAL RANDOM NUMBERS FOR I = 1 1 100
LET Y2 = EXPONENTIAL RANDOM NUMBERS FOR I = 1 1 100
LET Y3 = UNIFORM RANDOM NUMBERS FOR I = 1 1 100
WRITE RANDOM.DAT Y1 Y2 Y3
Program 2:
SET CONVERT CHARACTER CATEGORICAL
SET ROW LABEL COLUMN 1
READ TEST_CHAR.DAT IROW Y X1 X2
.
SET WRITE DECIMALS 1
WRITE ROWLABEL Y X1 X2
The following output is returned
----------------------------------------------------------------------
ROWLABEL Y X1 X2
----------------------------------------------------------------------
Row_1 8.0 1.0 1.0
Row_2 2.0 2.0 2.0
Row_3 1.0 1.0 3.0
Row_4 7.0 2.0 1.0
Row_5 3.0 1.0 2.0
Program 3:
SET CONVERT CHARACTER ON
SET ROW LABEL COLUMN 1
READ TEST_CHAR.DAT IROW Y X1 X2
.
SET WRITE DECIMALS 1
WRITE ROWLABEL Y X1 X2
The following output is returned
------------------------------------------------------------------------------------------
ROWLABEL Y X1 X2
------------------------------------------------------------------------------------------
Row_1 8.0 xxx1 yyy1
Row_2 2.0 xxx2 yyy2
Row_3 1.0 xxx1 yyy3
Row_4 7.0 xxx2 yyy1
Row_5 3.0 xxx1 yyy2
Program 4:
set convert character on
skip 25
read draft69c.dat rank day month
.
let ig = group label month
set write decimals 2
write rank day month ig
The following output is returned
GROUP LABELS--
GROUP LABEL 1 NAME: IG
LEVEL 1: January
LEVEL 2: February
LEVEL 3: March
LEVEL 4: April
LEVEL 5: May
LEVEL 6: June
LEVEL 7: July
LEVEL 8: August
LEVEL 9: September
LEVEL 10: October
LEVEL 11: November
LEVEL 12: December
-------------------------------------------------------
RANK DAY MONTH
-------------------------------------------------------
258.00 1.00 January
115.00 2.00 January
365.00 3.00 January
45.00 4.00 January
292.00 5.00 January
250.00 6.00 January
300.00 7.00 January
251.00 8.00 January
327.00 9.00 January
341.00 10.00 January
244.00 11.00 January
342.00 12.00 January
190.00 13.00 January
102.00 14.00 January
194.00 15.00 January
364.00 16.00 January
15.00 17.00 January
270.00 18.00 January
306.00 19.00 January
156.00 20.00 January
223.00 21.00 January
178.00 22.00 January
206.00 23.00 January
279.00 24.00 January
50.00 25.00 January
349.00 26.00 January
203.00 27.00 January
157.00 28.00 January
62.00 29.00 January
91.00 30.00 January
145.00 31.00 January
92.00 32.00 February
77.00 33.00 February
307.00 34.00 February
128.00 35.00 February
237.00 36.00 February
132.00 37.00 February
304.00 38.00 February
346.00 39.00 February
124.00 40.00 February
345.00 41.00 February
195.00 42.00 February
344.00 43.00 February
229.00 44.00 February
215.00 45.00 February
316.00 46.00 February
332.00 47.00 February
221.00 48.00 February
247.00 49.00 February
189.00 50.00 February
312.00 51.00 February
25.00 52.00 February
357.00 53.00 February
218.00 54.00 February
137.00 55.00 February
340.00 56.00 February
54.00 57.00 February
19.00 58.00 February
24.00 59.00 February
173.00 60.00 February
242.00 61.00 March
112.00 62.00 March
264.00 63.00 March
179.00 64.00 March
131.00 65.00 March
317.00 66.00 March
207.00 67.00 March
43.00 68.00 March
165.00 69.00 March
356.00 70.00 March
254.00 71.00 March
286.00 72.00 March
169.00 73.00 March
118.00 74.00 March
140.00 75.00 March
311.00 76.00 March
28.00 77.00 March
362.00 78.00 March
305.00 79.00 March
314.00 80.00 March
95.00 81.00 March
249.00 82.00 March
94.00 83.00 March
360.00 84.00 March
159.00 85.00 March
32.00 86.00 March
280.00 87.00 March
210.00 88.00 March
46.00 89.00 March
109.00 90.00 March
38.00 91.00 March
26.00 92.00 April
183.00 93.00 April
302.00 94.00 April
359.00 95.00 April
351.00 96.00 April
313.00 97.00 April
199.00 98.00 April
334.00 99.00 April
366.00 100.00 April
5.00 101.00 April
228.00 102.00 April
151.00 103.00 April
171.00 104.00 April
343.00 105.00 April
222.00 106.00 April
321.00 107.00 April
61.00 108.00 April
175.00 109.00 April
158.00 110.00 April
214.00 111.00 April
138.00 112.00 April
259.00 113.00 April
219.00 114.00 April
185.00 115.00 April
236.00 116.00 April
296.00 117.00 April
23.00 118.00 April
267.00 119.00 April
198.00 120.00 April
16.00 121.00 April
67.00 122.00 May
363.00 123.00 May
104.00 124.00 May
276.00 125.00 May
318.00 126.00 May
319.00 127.00 May
353.00 128.00 May
336.00 129.00 May
136.00 130.00 May
320.00 131.00 May
330.00 132.00 May
133.00 133.00 May
163.00 134.00 May
355.00 135.00 May
71.00 136.00 May
177.00 137.00 May
287.00 138.00 May
66.00 139.00 May
18.00 140.00 May
231.00 141.00 May
225.00 142.00 May
322.00 143.00 May
33.00 144.00 May
217.00 145.00 May
323.00 146.00 May
98.00 147.00 May
107.00 148.00 May
269.00 149.00 May
42.00 150.00 May
273.00 151.00 May
44.00 152.00 May
204.00 153.00 June
230.00 154.00 June
127.00 155.00 June
326.00 156.00 June
338.00 157.00 June
255.00 158.00 June
2.00 159.00 June
266.00 160.00 June
246.00 161.00 June
358.00 162.00 June
348.00 163.00 June
30.00 164.00 June
339.00 165.00 June
76.00 166.00 June
241.00 167.00 June
220.00 168.00 June
75.00 169.00 June
86.00 170.00 June
289.00 171.00 June
205.00 172.00 June
361.00 173.00 June
335.00 174.00 June
257.00 175.00 June
299.00 176.00 June
263.00 177.00 June
135.00 178.00 June
56.00 179.00 June
167.00 180.00 June
39.00 181.00 June
328.00 182.00 June
141.00 183.00 July
252.00 184.00 July
325.00 185.00 July
21.00 186.00 July
202.00 187.00 July
187.00 188.00 July
48.00 189.00 July
200.00 190.00 July
120.00 191.00 July
294.00 192.00 July
213.00 193.00 July
9.00 194.00 July
268.00 195.00 July
298.00 196.00 July
130.00 197.00 July
227.00 198.00 July
8.00 199.00 July
79.00 200.00 July
297.00 201.00 July
278.00 202.00 July
324.00 203.00 July
265.00 204.00 July
58.00 205.00 July
162.00 206.00 July
260.00 207.00 July
121.00 208.00 July
182.00 209.00 July
35.00 210.00 July
31.00 211.00 July
47.00 212.00 July
68.00 213.00 July
36.00 214.00 August
4.00 215.00 August
41.00 216.00 August
90.00 217.00 August
101.00 218.00 August
100.00 219.00 August
284.00 220.00 August
12.00 221.00 August
180.00 222.00 August
88.00 223.00 August
6.00 224.00 August
245.00 225.00 August
150.00 226.00 August
201.00 227.00 August
154.00 228.00 August
303.00 229.00 August
329.00 230.00 August
105.00 231.00 August
248.00 232.00 August
271.00 233.00 August
281.00 234.00 August
17.00 235.00 August
55.00 236.00 August
285.00 237.00 August
14.00 238.00 August
80.00 239.00 August
354.00 240.00 August
293.00 241.00 August
256.00 242.00 August
295.00 243.00 August
277.00 244.00 August
239.00 245.00 September
262.00 246.00 September
174.00 247.00 September
193.00 248.00 September
153.00 249.00 September
142.00 250.00 September
3.00 251.00 September
114.00 252.00 September
97.00 253.00 September
290.00 254.00 September
261.00 255.00 September
83.00 256.00 September
272.00 257.00 September
84.00 258.00 September
73.00 259.00 September
108.00 260.00 September
216.00 261.00 September
119.00 262.00 September
253.00 263.00 September
301.00 264.00 September
82.00 265.00 September
309.00 266.00 September
63.00 267.00 September
87.00 268.00 September
96.00 269.00 September
211.00 270.00 September
93.00 271.00 September
164.00 272.00 September
106.00 273.00 September
168.00 274.00 September
64.00 275.00 October
125.00 276.00 October
191.00 277.00 October
139.00 278.00 October
186.00 279.00 October
20.00 280.00 October
333.00 281.00 October
315.00 282.00 October
282.00 283.00 October
192.00 284.00 October
60.00 285.00 October
238.00 286.00 October
212.00 287.00 October
291.00 288.00 October
209.00 289.00 October
53.00 290.00 October
234.00 291.00 October
49.00 292.00 October
65.00 293.00 October
288.00 294.00 October
134.00 295.00 October
148.00 296.00 October
34.00 297.00 October
123.00 298.00 October
59.00 299.00 October
72.00 300.00 October
155.00 301.00 October
51.00 302.00 October
208.00 303.00 October
352.00 304.00 October
1.00 305.00 October
7.00 306.00 November
226.00 307.00 November
149.00 308.00 November
331.00 309.00 November
310.00 310.00 November
232.00 311.00 November
99.00 312.00 November
152.00 313.00 November
347.00 314.00 November
274.00 315.00 November
113.00 316.00 November
69.00 317.00 November
13.00 318.00 November
144.00 319.00 November
350.00 320.00 November
129.00 321.00 November
197.00 322.00 November
70.00 323.00 November
224.00 324.00 November
10.00 325.00 November
143.00 326.00 November
188.00 327.00 November
337.00 328.00 November
11.00 329.00 November
122.00 330.00 November
196.00 331.00 November
78.00 332.00 November
243.00 333.00 November
81.00 334.00 November
161.00 335.00 November
110.00 336.00 December
22.00 337.00 December
40.00 338.00 December
235.00 339.00 December
117.00 340.00 December
170.00 341.00 December
283.00 342.00 December
85.00 343.00 December
233.00 344.00 December
111.00 345.00 December
103.00 346.00 December
37.00 347.00 December
308.00 348.00 December
29.00 349.00 December
184.00 350.00 December
116.00 351.00 December
240.00 352.00 December
181.00 353.00 December
74.00 354.00 December
27.00 355.00 December
166.00 356.00 December
147.00 357.00 December
176.00 358.00 December
275.00 359.00 December
172.00 360.00 December
146.00 361.00 December
89.00 362.00 December
52.00 363.00 December
126.00 364.00 December
57.00 365.00 December
160.00 366.00 December
Program 5:
skip 25
read berger1.dat y x batch
set write decimals 5
.
fit y x
write1 fit_summary.out "a0: ^a0, a1: ^a1"
write1 fit_summary.out "ressd: ^ressd"
.
write fit_data.txt y x pred res
.
let corr = correlation y x
write1 fit_summary.out " "
write1 fit_summary.out " "
write1 fit_summary.out "Correlation: ^corr "
probe iwrin1
let iflag = close probeval
list fit_summary.out
.
write "Summary of fit statistics written to fit_summary.out"
write "Fit data, predicted values, residuals written to fit_data.txt"
The following output is generated for the WRITE1 file
a0: 4.993679936982, a1: 0.731111063855
ressd: 6.080923828158
Correlation: 0.945581893216
|
Privacy
Policy/Security Notice
NIST is an agency of the U.S.
Commerce Department.
Date created: 4/27/2009 | |||||||||||||||||||