convert mat to txt
조회 수: 11 (최근 30일)
이전 댓글 표시
I want to convert a mat file to a txt file with this format:
mat file --> a=[101,10,130,240]
txt file --> 1.101
2.10
3.130
4.240
댓글 수: 0
답변 (1개)
Javier Montalt Tordera
2019년 4월 12일
The following might help:
fid = fopen('file.txt','w');
for i = 1:length(a)
fprintf(fid,'%d.%d\n',i,a(i));
end
fclose(fid);
This assumes that the numbers in your vector are integers; if this is not true, you might want to use %f instead of %d (after the dot).
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Data Type Conversion에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!