Contents Previous Next Subchapters

Specifying Number of Elements per Output Line
Syntax write(filematrixmax)
See Also write , read , bread

Writes matrix to the specified file or the screen, where file is a character row vector. The output is similar to write(file, matrix) except that max is an integer scalar specifying the maximum number of elements written in each line.

If the number of columns in matrix is less than or equal to max, the write function writes one line of the file for each row of the matrix. If you enter
     x = {[1.1, 2.2], [3.3, 4.4]}
     write("TEMP.OMS", x, 5)
O-Matrix will write
     1.1 2.2
     3.3 4.4
to the file TEMP.OMS.

If the number of columns in matrix is greater than max, the write function uses the ellipsis ("...") to signify that a row continues on the next line of the file.
     x = {[1.1, 2.2, 3.3, 4.4, 5.5], [6.6, 7.7, 8.8, 9.9, 10.1]}
     write("screen", x, 3)
results in
     1.1 2.2 3.3 ...
     4.4 5.5
     6.6 7.7 8.8 ...
     9.9 10.1
Note that each row of the matrix ends in a line without an ellipsis.