dlmwrite does not append to file

5 visualizaciones (últimos 30 días)
Bob Thompson
Bob Thompson el 12 de Mzo. de 2021
Comentada: Bob Thompson el 12 de Mzo. de 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.

Respuesta aceptada

Cris LaPierre
Cris LaPierre el 12 de Mzo. de 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.
  1 comentario
Bob Thompson
Bob Thompson el 12 de Mzo. de 2021
Thanks, that does seem to have fixed it.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Data Import and Analysis en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by