How to control the significant digits in an xlswrite
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Douglas Anderson
el 10 de Ag. de 2015
Respondida: Walter Roberson
el 10 de Ag. de 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 comentarios
Respuesta aceptada
Walter Roberson
el 10 de Ag. de 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 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Startup and Shutdown en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!