how to write this data in text file?
2 ビュー (過去 30 日間)
古いコメントを表示
Hi,
how can i store my data in .txt as it is shown in workspace that is in separate column..
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/153828/image.jpeg)
where variable name is sets(9:i) now this i is 5 in this case but it could be other wise
for i=1:5
fprintf(fid, '%.2f\n',sets(9,i) );
end
not working..its writing all (9*5) data in a single column...
0 件のコメント
採用された回答
Sara
2014 年 7 月 30 日
Try this:
sets = rand(9,5)
for i = 1:9
fprintf(fid,'%.2f ',sets(i,:) );
fprintf(fid,'\n');
end
0 件のコメント
その他の回答 (2 件)
Roger Wohlwend
2014 年 7 月 30 日
Use the function csvwrite:
csvwrite(filename,Matrix)
Or consider saving the matrix in a mat-file using the command save.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Text Files についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!