how to save cell array which not have equal row in each column to .csv
Show older comments
hi ,i want to save cell array which not have equal row in each column to .csv it have 1x415cell each column not have same size it start from 4 row until in column 415 it have 33 row example data is

Answers (1)
Are Mjaavatten
on 5 Mar 2017
function cell2csv(c,filename)
% Writes a cell array of 1D arrays to a csv file
c = c(:);
fid = fopen(filename,'w');
lf = char(10); % linefeed character
delimiter = ',';
for i = 1:length(c(:))
line = '';
for j = 1:length(c{i})
line = [line,num2str(c{i}(j)),delimiter];
end
line = [line(1:end-1),lf]; % remove final comma
fwrite(fid,line);
end
fclose(fid);
Categories
Find more on Images in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!