FUNCTION REFERENCE
writelines
Write text lines to a file.
Write text lines to a file.
Syntax
writelines(lines, filename); writelines(lines, filename, Name, Value)Writes a string array, character array, or cell array of character vectors to filename, one line per element or row. Supports WriteMode ('overwrite' default, 'append'), LineEnding (default "\n" on all platforms), and Encoding ('UTF-8', 'US-ASCII', 'ISO-8859-1', 'system'). LineEnding interprets escape notation such as "\n" and "\r\n".
Example
writelines(["one"; "two"], "out.txt"); readlines("out.txt") % ["one"; "two"]Differences from MATLAB: LineEnding defaults to "\n" on all platforms; text is bounded to 256 KiB.
These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.