I have a matrix with size of 2000*1000. I want to save it into multiple .dat files in such way that each .dat file should have 2000*1 (One vector). So in this way I will have 1000 dat files. I tried many ways but no success yet. Any idea?

 採用された回答

Davide Masiello
Davide Masiello 2022 年 11 月 4 日

0 投票

This should work
A = rand(2000,1000);
for col = 1:size(A,2)
filename = ['Column_',num2str(col),'.dat'];
writematrix(A(:,col),filename)
end

1 件のコメント

Leostar90
Leostar90 2022 年 11 月 7 日
Thanks. It worked perfectly.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および 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!

Translated by