how to save cell array which not have equal row in each column to .csv

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)

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

Asked:

on 2 Mar 2017

Answered:

on 5 Mar 2017

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!