필터 지우기
필터 지우기

Save an array with multiple rows and columns in .txt file

조회 수: 8 (최근 30일)
Richard Wood
Richard Wood 2020년 3월 12일
댓글: Star Strider 2020년 3월 12일
Hello everyone,
my question is very simple. I have a big array (30001x2434 elements), and I want to save all the data in .txt file. Which is the correct syntax for that so that the final file respect the distribution of my current array? It would be great if I can directly save that file in a folder that it is inside the workspace where my script is.

채택된 답변

Star Strider
Star Strider 2020년 3월 12일
I would use the writematrix function (R2019a and later). Another option is dlmwrite (and its friends) if you do not have writematrix.
  댓글 수: 3
Richard Wood
Richard Wood 2020년 3월 12일
Just a question about writematrix function. Does it save the elements of my matrix with the same precision as that which appears in MatLab? Does it maintain scientific notation when it shows MatLab like this?
Star Strider
Star Strider 2020년 3월 12일
I have no idea what you are doing in the earlier Comment. Please see the documentation I linked to for the writematrix function. It will tell you how to use it.
Just a question about writematrix function. Does it save the elements of my matrix with the same precision as that which appears in MatLab?
It appears to, yes.
Does it maintain scientific notation when it shows MatLab like this?
If it needs to, yes. The documentation does not mention that specifically.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Text Files에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by