How can I save matrix to .txt file?

260 次查看(过去 30 天)
I have numerical matrix size of 64*60 and I like to save it to .txt file. How can I do it as easy as possible? without repeating %d with fprintf?

采纳的回答

Friedrich
Friedrich 2013-3-13
编辑:Friedrich 2013-3-13
Hi,
use dlmwrite
a = rand(64,60);
dlmwrite('filename.txt',a)
  5 个评论
Aravind Rao Karanam
dlmwrite is not recommended anymore. Use writematrix
a = rand(64,60);
writematrix(a, 'filename.txt')

请先登录,再进行评论。

更多回答(2 个)

Sudhir Rai
Sudhir Rai 2020-11-17
Use this to get perfect matrix in .txt
X = rand(64,60)
save ('filename.txt', 'X', '-ascii')

Almuthana Alharbi
Almuthana Alharbi 2018-4-11
Thanks

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by