Problem with export txt file and the delimited value

조회 수: 3 (최근 30일)
francisco gonzalez
francisco gonzalez 2015년 5월 10일
답변: Walter Roberson 2015년 5월 10일
Hi all,
I want to export the results of a moving average of period 5 to a .txt file. But when I do the following code:
dlmwrite(newName, fresult,'precision','%.5f');
Delimited in the .txt file it is as follows:
1.12084
1.12091
1.12094
1.12091
1.12086
How I can do to appear "," or ";" provided that the number of decimal places is maintained.
thank you very much

채택된 답변

Walter Roberson
Walter Roberson 2015년 5월 10일
dlmwrite() only puts delimiters between columns, as otherwise programs would think that there was another column that happened to be empty.
You might want to use
dlmwrite(newname, fresult', 'precisiton', '%.5f');
to put everything on one line.
But if you really need the single column and you need ';' on the end of the lines, then you can hack a little:
dlmwrite(newName, fresult,'precision','%.5f;');
notice the delimiter added to the end of the precision specification.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Type Conversion에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

제품

Community Treasure Hunt

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

Start Hunting!

Translated by