Skip to content

writelines

io · scripts/io/writelines.m

: writelines (lines, filename)
: writelines (lines, filename, Name, Value)

Write text lines to a file (MATLAB R2022a+ / R2026a compat).

lines may be a string array, character vector, or cell array of character vectors. Supported name-value options:

"WriteMode"

"overwrite" (default) or "append".

"LineEnding"

Line terminator string. Default is newline (LF). Use sprintf ("\r\n") for CRLF.

"Encoding"

Passed to fopen. Default is the system encoding.