How can I display a number with only two digits after the decimal point in MATLAB?
761 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Mardhika Jenned
am 3 Mär. 2011
Kommentiert: Walter Roberson
am 16 Sep. 2021
I would like to display a number with only two digits after the decimal point in MATLAB.
2 Kommentare
Jan
am 3 Mär. 2011
What is the relation to the tag "digital signal processing"? Can you explain any details concerning the question, please?
Akzeptierte Antwort
Weitere Antworten (4)
masoud sistaninejad
am 30 Dez. 2020
format shortg
y = 3.3333333333333333333333333333333333333
y_out = round(y,2)
0 Kommentare
Walter Roberson
am 31 Dez. 2020
For the specific case of 2 decimal places (does not work for any other number)
format bank
10/3
4 Kommentare
Walter Roberson
am 16 Sep. 2021
x = 10/3;
sprintf('%05.2f', x)
compose("%05.2f", x)
num2str(x, '%05.2f')
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!