<< readtable | Spreadsheet | writematrix >> |
writecell(C) |
writecell(C, filename) |
writecell(..., Name, Value) |
an cell array.
a string: filename destination.
Name-Value Arguments
writecell writes an cell array to an CSV format file.
writecell does not support sparse matrices.
writecell outputs numeric data in the long G format.
Available Name-Value Arguments
Name-value pairs must follow all other arguments.
The order of name-value pairs doesn't matter
Delimiter and QuoteStrings options only apply to delimited text files.
FileType: Specifies the type of output file
Syntax: 'FileType','text'
Supports delimited text files (.txt, .dat, .csv)
WriteMode: Controls how data is written to the file
Syntax: 'WriteMode', mode
Options:
'overwrite' (default) - Creates new file or replaces existing content
'append' - Adds data to end of existing file
If the target file doesn't exist, a new file will be created regardless of mode.
Delimiter: Defines the character used to separate fields
Syntax: 'Delimiter', delimiter
Available Delimiters: Only applicable for delimited text files.
Specifier | Alternative | Description |
---|---|---|
','
|
'comma'
|
Comma (default) |
' '
|
'space'
|
Space character |
'\t'
|
'tab'
|
Tab character |
';'
|
'semi'
|
Semicolon |
'|'
|
'bar'
|
Vertical bar |
QuoteStrings: Controls text quoting behavior (Only applicable for delimited text files).
'QuoteStrings', option
with options
'minimal' (default) Quotes only text containing delimiters, line endings, or quotes.
'all' Quotes all text variables.
'none' Uses no quotes.
C = {'ID', 'Product', 'Price'; 1, 'Laptop', 799.99; 2, 'Phone', 699.49; 3, 'Tablet', 499.00};
filename = [tempdir(), 'writecell_example.csv'];
writecell(C, filename);
R = fileread(filename)
readcell, csvwrite, dlmread, fileread.
Version | Description |
---|---|
1.10.0 | initial version |
Allan CORNET