Chnage number display format
Mostra commenti meno recenti
Hi,
The numbers in the first column of my output writing to a text file shows like 3e+006.
But I want to display like 3000001.
How can I change that in MATLAB?
Thanks.
Risposte (1)
Sean de Wolski
il 23 Mag 2014
How are you writing it right now? If you are using fprintf you can change the format spec. For example:
fprintf(1,'%10.0f\n',randi(10,[5, 1])*2347348)
4 Commenti
Damith
il 23 Mag 2014
Sean de Wolski
il 23 Mag 2014
Modificato: Sean de Wolski
il 23 Mag 2014
I would read in the entire file with csvread or dlmread, and then write it back out with dlmwrite which offers precision. IF you need finer control over the formatspec, then fprintf would work here as well.
Damith
il 23 Mag 2014
Damith
il 24 Mag 2014
Categorie
Scopri di più su Text Files in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!