Cell Array to CSV-file

Writes cell array content into a *.csv file.
78 Downloads
Updated 1 Jul 2016

View License

Different and faster, but accepts less input types compared to Jerry's code ( https://www.mathworks.com/matlabcentral/fileexchange/47055-cell-array-to-csv-file--improved-cell2csv-m- ). Though more options to control output Format with formatSpec.
CELL2CSV(filename,cellArray,delimiter,float_format,int_format,string_format)
Writes cell array content into a *.csv file.
Accepts cell arrays containing strings, numeric, empty or logicals.
Output of logicals is 0 / 1. Length of numeric and logicals must be 1.
Parameters:
name size type = description

required parameter:
filename [?](char) = Name of the file to save including file extension. Full or relativ path.
cellarray [? X ?](cell) = Cell Array where the data is in.

optional parameters:
delimiter [1](char) = seperating sign, default: ','
float_format [?](char) = formatSpec for floating-point numbers, default: '%f'
int_format [?](char) = formatSpec for integers, default: '%i'
string_format [?](char) = formatSpec for strings, default: '%s'

If using an optional parameter all previous parameters must be set
whole-number double or single are treated as integers
formatSpec needs to be accepted by sprintf: http://de.mathworks.com/help/matlab/ref/sprintf.html#inputarg_formatSpec

Cite As

Nau Nicolas (2026). Cell Array to CSV-file (https://www.mathworks.com/matlabcentral/fileexchange/57953-cell-array-to-csv-file), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2014b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Version Published Release Notes
1.0.0.0

changed description