dlmwrite does not append to file

5 ビュー (過去 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 Center および File ExchangeData 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