필터 지우기
필터 지우기

How can I save matrix to .txt file?

조회 수: 232 (최근 30일)
Teemu
Teemu 2013년 3월 13일
댓글: Aravind Rao Karanam 2022년 1월 8일
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
Mohammad Homayounpour
Mohammad Homayounpour 2020년 4월 7일
Yes
Aravind Rao Karanam
Aravind Rao Karanam 2022년 1월 8일
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

카테고리

Help CenterFile Exchange에서 Characters and Strings에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by