dlmwrite does not append to file

5 visualizzazioni (ultimi 30 giorni)
Bob Thompson
Bob Thompson il 12 Mar 2021
Commentato: Bob Thompson il 12 Mar 2021
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.

Risposta accettata

Cris LaPierre
Cris LaPierre il 12 Mar 2021
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.

Più risposte (0)

Categorie

Scopri di più su Data Import and Analysis in Help Center e File Exchange

Prodotti


Release

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by