Show more digit number in command window
35 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
armin m
el 4 de Dic. de 2021
Comentada: armin m
el 5 de Dic. de 2021
Hi. I wanna see 6 digits numbers in command window for output tesult.
Digits(6)
Why above code does not work? Tnx
0 comentarios
Respuesta aceptada
Más respuestas (1)
Steven Lord
el 5 de Dic. de 2021
Are you trying to display a numeric result (in which case you should use the format function to change the format used to display numeric results) or a symbolic result (in which case you could use vpa)?
3 comentarios
Walter Roberson
el 5 de Dic. de 2021
Editada: Walter Roberson
el 5 de Dic. de 2021
Digits() only affects floating point symbolic numbers; it has no affect on double precision or single precision.
There is no method to get exactly 6 digits in the command window. "format short" will give you 5 digits, and "format long g" will give you 15 digits. There is no way to customize the display to 6 digits.
However... if you were to round(TheData, 6) and display it with "format long g" in effect, you would mostly see 6 or fewer digits
format short
A = rand(2,5);
A
round(A,6)
format long g
A
round(A,6)
Ver también
Categorías
Más información sobre Numbers and Precision en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!