I have got a cell array Ystg of size 219*1 and i want to write it into a text file .
我试过这段代码但是没有用
C = Ystg.';
fid = fopen('file.dlm', 'wt');
fprintf(fid, '"%s"\t"%s"\t"%d"\t"%s"\t\n', C{:});
fclose(fid);`
答案 0 :(得分:1)
这应该适合你:
C = Ystg;
fid = fopen('file.dlm', 'wt');
for i=1:219
fprintf(fid, '"%s"\t"%s"\t"%d"\t"%s"\t\n', C{i}{:});
end
fclose(fid);