Function that returns value after decimal point?
8 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Is there a function that returns the value after the decimal?
EX:
a = 2.876
function(a) = 0.876
Thank You
0 Commenti
Risposta accettata
Più risposte (1)
Azzi Abdelmalek
il 4 Ott 2012
Modificato: Azzi Abdelmalek
il 4 Ott 2012
out=a-fix(a)
%or
A=num2str(a);
out=str2num(['0' A(strfind(A,'.'):end)])
2 Commenti
Azzi Abdelmalek
il 4 Ott 2012
Modificato: Azzi Abdelmalek
il 4 Ott 2012
a=1
a-fix(a)=0
and
A=num2str(a);
out=str2num(['0' A(strfind(A,'.'):end)])=0
Vedere anche
Categorie
Scopri di più su Operators and Elementary Operations in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!