How to export a matrix in a text file?

조회 수: 4 (최근 30일)
afrya
afrya 2014년 1월 10일
댓글: Raghav Rathi 2020년 7월 27일
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

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2014년 1월 10일
A=[1 2
3 4
5 6]
dlmwrite('dataexport.txt',A,'delimiter','\t','newline','pc')
  댓글 수: 1
afrya
afrya 2014년 1월 10일
Thanks for your answer akhi

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Mischa Kim
Mischa Kim 2014년 1월 10일
Try dlmwrite('dataexport.txt',A,'newline','pc').
  댓글 수: 3
afrya
afrya 2014년 1월 10일
Thanks for your answer
Raghav Rathi
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 CenterFile Exchange에서 Data Import and Export에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by