How to export a matrix in a text file?
조회 수: 4 (최근 30일)
이전 댓글 표시
Hello,
I want to save a matrix in a text file with the data organised in columns. Exemple:
A=
1 2
3 4
5 6
I want to get a text file in which A looks like :
A=
1 2
3 4
5 6
When I used the following function dlmwrite('dataexport.txt',a,'delimiter','\t'), I get
a text file with A=1 2 3 4 5 6
Thanks in advance
댓글 수: 0
채택된 답변
Azzi Abdelmalek
2014년 1월 10일
A=[1 2
3 4
5 6]
dlmwrite('dataexport.txt',A,'delimiter','\t','newline','pc')
추가 답변 (1개)
Mischa Kim
2014년 1월 10일
Try dlmwrite('dataexport.txt',A,'newline','pc').
댓글 수: 3
Raghav Rathi
2020년 7월 27일
I am getting the following error while using dlmwrite('dataexport.txt',A,'newline','pc','delimiter',' ').
" Error using writematrix (line 156)
Invalid parameter name: newline. "
Is there any change in writemartix now?
참고 항목
카테고리
Help Center 및 File Exchange에서 Data Import and Export에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!