READFILE("file", "type",
[colwidths], [rows], [cols], [emptyfill]) Returns an array
containing the data in file. The optional arguments give much of the same flexibility found in the Data Import Wizard, for use in programs.
WRITEFILE(M, "file", "type", ["header"]) Writes M as data of format type to file.
APPENDFILE(M, "file", "type") Appends M to the contents of file as data of format type.
type is a string that specifies the data format used in the file:
delimited - data columns separated by a consistent delimiter (including those produced by WRITEPRN and APPENDPRN).
fixed - fixed-column-width data.
Excel - Excel file formats.
Unicode - UTF-8 text data.
colwidths (required for type fixed, omitted otherwise) an n × 1 column vector specifying the number of characters in each fixed-width column, where n is the total number of columns in the datafile.
rows (optional) either a scalar specifying the first row to read, or a 2-element vector specifying the range of rows (inclusive) to read. If this argument is omitted, READFILE reads in every row of the file.
cols (optional) either a scalar specifying the first column to read from the file or a 2-element vector specifying the range of columns (inclusive) to read from the file. If this argument is omitted, READFILE reads in every column of the entire datafile.
emptyfill (optional) a string, scalar, or NaN, which is substituted for missing entries in the data file. NaN is the default.
M a matrix of values to write (or append) to the specified file.
header (optional) a string of descriptive, non-data text to appear in the file.
Notes:
Both rows and cols are indexes that start with 1. ORIGIN does not affect the behavior of READFILE.
Behavior of any function that reads from or writes to data files is unpredictable if the worksheet has never been saved. Path information for a file is uncertain until the file is saved in a particular location.
WRITEFILE and APPENDFILE can be used on either the left- or right-hand side of an expression.