F.caren
F.caren

Reputation: 95

how could i write the content of a cell array or matrix into a text-file?

I have got a cell array Ystg of size 219*1 and i want to write it into a text file .

i tried this code but doesn't work

    C = Ystg.';
fid = fopen('file.dlm', 'wt');
fprintf(fid, '"%s"\t"%s"\t"%d"\t"%s"\t\n', C{:});
fclose(fid);`

enter image description here

Upvotes: 1

Views: 54

Answers (1)

Hadi
Hadi

Reputation: 1213

this should work for you :

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);

Upvotes: 1

Related Questions