WRITE command

Syntax: | `WRITE file x1 { x2 ... } WRITE\SCALAR file s1 { s2 ... } WRITE\MATRIX file matrix WRITE\TEXT file txtvar`
Qualifiers: | `\SCALAR, \MATRIX, \TEXT, \APPEND`
Examples: | `WRITE FILE.DAT X Y Z WRITE\APPEND FILE.DAT X Y Z WRITE\SCALAR FILE.DAT A B C WRITE\SCALAR\APPEND FILE.DAT A B C WRITE\MATRIX\APPEND FILE.DAT M[1:100,1:10] WRITE\TEXT FILE.DAT `X['//RCHAR(J)//`] = '//RCHAR(X[J]) WRITE\TEXT\APPEND FILE.DAT `A = '//RCHAR(A)`

The `WRITE` 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.

Write vectors

By default, the `WRITE` command writes vectors to a file. If the `\APPEND` 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 `I`th column will be vector `xI`. The number of lines that are written to the file will be the minimum length of the vectors. A maximum of `29` vectors can be written with one `WRITE` command.

Example 1

If you have a vector, for example, `X`, and enter `WRITE FILE.DAT X X X` then the following values will be written to the file:

     X(1) X(2) X(3)
     X(4) X(5) X(6)
     ...

Example 2

To write the vectors `X`, `Y` and `Z` to the file `DUM.DAT` so that there will be three columns of numbers in the file, enter: `WRITE DUM.DAT X Y Z`

If you enter: `WRITE DUM.DAT X X Y Y Z Z` then the following will be written to the file:

        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)
        ...  ...  ...  ...  ...  ...

Write scalars
Write a matrix
Write a character string