how to save cell array which not have equal row in each column to .csv
Afficher commentaires plus anciens
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

Réponses (1)
Are Mjaavatten
le 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);
Catégories
En savoir plus sur Images dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!