How to control the significant digits in an xlswrite
7 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Douglas Anderson
am 10 Aug. 2015
Beantwortet: Walter Roberson
am 10 Aug. 2015
Hello!
I got some very good answers to a previous post about Excel xlswrite and the MATLAB COM API, controlling the number of columns. That made the write come out not "squished", but now I've got a zillion decimal digits! (well, nine really, but only three are meaningful). Any suggestions on this?
This looks like a great utility, but I haven't figured out where it is documented.
Thanks again.
Doug
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 10 Aug. 2015
If you are not using xlswrite() in 'basic' mode then numeric values are written in binary so the number of decimals cannot be controlled by xlswrite(). The work-around is to adjust the number of decimal places before you call xlswrite().
Caution: the only three decimal digit fractions that can be exactly represented in binary are .0, .125, .25, .375, .5, .625, .75, .875 . You can use round(Value*1000)/1000 to approximate 3 decimal places, but the approximations will not be exact except for the 8 values I list.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Startup and Shutdown finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!