How to write multiple txt files from workspace matrix?
1 回表示 (過去 30 日間)
古いコメントを表示
Eduardo Ortiz
2014 年 3 月 31 日
コメント済み: Peranantham Uruthiran
2019 年 1 月 30 日
Hi,
I'm trying to save multiple .txt files from one single matrix on workspace ('My_matrix'). My_matrix has 480 lines and 116 columns. I'd like to have 116 .txt files, each one containing two columns, the first column for all the 116 files is the same [1,2,...,480] and the second column is the first, second,...,116th column of My_matrix.
Thank you in advance for your kind attention.
Eduardo O.
0 件のコメント
採用された回答
Marta Salas
2014 年 4 月 1 日
X= 1:size(My_matrix,1);
for it=1:size(My_matrix,2)
filename = ['Mytext' num2str(it) '.txt'];
data = [X' My_matrix(:,it)];
dlmwrite(filename,data,'delimiter','\t','precision',3)
end
2 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Get Started with MATLAB についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!