Extract N number of digits after the dot
8 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
neamah al-naffakh
am 9 Okt. 2017
Kommentiert: Star Strider
am 9 Okt. 2017
Hi guys,
suppose N=1234.4345
I would like to store in this variable the decimal number and the first two digits only after the dot.
(e.g. N=1234.43 )
Kind Regards.
0 Kommentare
Akzeptierte Antwort
Star Strider
am 9 Okt. 2017
You can use the most recent version of the round function, or use this emulation of it:
roundn = @(x,n) round(x .* 10.^n)./10.^n; % Round ‘x’ To ‘n’ Digits, Emulates Latest ‘round’ Function
N = 1234.4345
N = roundn(N,2)
N =
1234.4345
N =
1234.43
2 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Matched Filter and Ambiguity Function finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!