dlmwrite 0 to 0.0

3 vues (au cours des 30 derniers jours)
Anna Cole
Anna Cole le 4 Juin 2018
Commenté : Walter Roberson le 4 Juin 2018
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.

Réponse acceptée

Walter Roberson
Walter Roberson le 4 Juin 2018
Use 'precision', '%.1f' for dlmwrite()
  2 commentaires
Anna Cole
Anna Cole le 4 Juin 2018
Can I have a different precision for different columns in dlmwrite?
Walter Roberson
Walter Roberson le 4 Juin 2018
Sorry, that is not possible with dlmwrite(). You should fopen/fprintf/fclose for that.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Cell Arrays dans Help Center et File Exchange

Tags

Produits


Version

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by