save a m*n cell file as n text files
1 view (last 30 days)
Show older comments
Bhaskar panchireddi
on 2 Jun 2016
Commented: Bhaskar panchireddi
on 2 Jun 2016
My matlab code is generating a cell of order 10000*100. I have to save all the columns of this cell in text format separately. I mean i should get 100 text files. what should i do? please help
Accepted Answer
Ahmed Rashid
on 2 Jun 2016
a = rand(1000, 100);
for k = 1:100
fileID = fopen(['data', num2str(k), '.txt'],'w');
fprintf(fileID,'%f\n',a(:, k));
fclose(fileID);
end
5 Comments
More Answers (0)
See Also
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!