dlmwrite does not append to file

조회 수: 6 (최근 30일)
Bob Thompson
Bob Thompson 2021년 3월 12일
댓글: Bob Thompson 2021년 3월 12일
I am writing headers and data to a text file, and I am able to write the headers using fprintf, so I know my filepath is correct, but my dlmwrite command will not append the data to the file.
fprintf(ffile,'%s %s %s %s %s\n',headers{:});
dlmwrite(fullfileout,outmatrix,'-append','precision','%$.8f');
I believe this was written in 2016 or 2017 MATLAB, and I am now using 2019b. Was there a change to dlmwrite that I need to update?
No error message is received, the files just end up only including the header. outmatrix is not empty, and the code has worked in the past without any changes.
I know that dlmwrite has been replaced with writematrix, but version 2019b doesn't support the 'WriteMode','append' options in writematrix.

채택된 답변

Cris LaPierre
Cris LaPierre 2021년 3월 12일
The error I see is due to the dollar sign in your precision. Remove that, and it prints the numbers in the desired format.
The dollar sign represents the identifier, and should be preceded by a number to work as designed. See here.
  댓글 수: 1
Bob Thompson
Bob Thompson 2021년 3월 12일
Thanks, that does seem to have fixed it.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Import and Analysis에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by