What is the best way to save data into a txt file
이전 댓글 표시
I have these data in a matrix and I want to save them into a txt file
but I got diffrenet values than what in my matrix it was something like this (in that format)
4.6998106645411053e+02
I used save fuction to try and save my data I want to save is there another way to save data into txt file?
save('new doc.txt','M','-ascii','-double','-tabs') % M is the matrix
type('new doc.txt')
6540601141.61867 13577823444.2938 28101317825.1798
7569519373.48601 15264346993.3944 30754547025.5567
7387340146.18493 15158865708.5425 31019062144.9410
6251317371.90850 12958424682.6582 26803084252.4354
6734644847.83862 13687649437.8130 27810201085.8812
6849537690.44554 14134553528.2659 29089340966.3231
7385568328.07828 15044694671.3799 30591374573.0212
6381280737.62946 12989993198.7250 26448459532.9256
댓글 수: 3
dpb
2019년 3월 21일
Show us what
disp M
gives for the same M. I've never seen save not write the correct data; I'd be willing to bet that is what was in M.
There are any number of ways to write text files; if you have need for a given format, then fprintf is your basic choice; the other, simpler ways make assumptions about precision and format to save you the trouble.
will99
2019년 3월 22일
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Text Files에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!