Navigation

Operators and Keywords

Function List:

C++ API

: dlmwrite (file, M)
: dlmwrite (file, M, delim, r, c)
: dlmwrite (file, M, key, val …)
: dlmwrite (file, M, "-append", …)
: dlmwrite (fid, …)

Write the numeric matrix M to the text file file using a delimiter.

file should be a filename or a writable file ID given by fopen.

The parameter delim specifies the delimiter to use to separate values on a row. If no delimiter is specified the comma character ‘,’ is used.

The value of r specifies the number of delimiter-only lines to add to the start of the file.

The value of c specifies the number of delimiters to prepend to each line of data.

If the argument "-append" is given, append to the end of file.

In addition, the following keyword value pairs may appear at the end of the argument list:

"append"

Either "on" or "off". See "-append" above.

"delimiter"

See delim above.

"newline"

The character(s) to separate each row. Three special cases exist for this option. "unix" is changed into "\n", "pc" is changed into "\r\n", and "mac" is changed into "\r". Any other value is used directly as the newline separator.

"roffset"

See r above.

"coffset"

See c above.

"precision"

The precision to use when writing the file. It can either be a format string (as used by fprintf) or a number of significant digits.

dlmwrite ("file.csv", reshape (1:16, 4, 4));
dlmwrite ("file.tex", a, "delimiter", "&", "newline", "\n")

See also: dlmread, csvread, csvwrite.

Package: octave