I am using dlmwrite to create two columns in a text file. The first column contains numbers (a=[1:1:100]) and then second column contains zeros (b=zeros(100,1). I then concatenated them and replaced some of the zeros with numbers. When written to a file I need the zeros to display as 0.0 instead of 0. I currently have it written to a .txt file.

 Respuesta aceptada

Walter Roberson
Walter Roberson el 4 de Jun. de 2018

0 votos

Use 'precision', '%.1f' for dlmwrite()

2 comentarios

Anna Cole
Anna Cole el 4 de Jun. de 2018
Can I have a different precision for different columns in dlmwrite?
Walter Roberson
Walter Roberson el 4 de Jun. de 2018
Sorry, that is not possible with dlmwrite(). You should fopen/fprintf/fclose for that.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Productos

Versión

R2018a

Etiquetas

Preguntada:

el 4 de Jun. de 2018

Comentada:

el 4 de Jun. de 2018

Community Treasure Hunt

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

Start Hunting!

Translated by