Function that returns value after decimal point?
8 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Is there a function that returns the value after the decimal?
EX:
a = 2.876
function(a) = 0.876
Thank You
0 commentaires
Réponse acceptée
Plus de réponses (1)
Azzi Abdelmalek
le 4 Oct 2012
Modifié(e) : Azzi Abdelmalek
le 4 Oct 2012
out=a-fix(a)
%or
A=num2str(a);
out=str2num(['0' A(strfind(A,'.'):end)])
2 commentaires
Azzi Abdelmalek
le 4 Oct 2012
Modifié(e) : Azzi Abdelmalek
le 4 Oct 2012
a=1
a-fix(a)=0
and
A=num2str(a);
out=str2num(['0' A(strfind(A,'.'):end)])=0
Voir également
Catégories
En savoir plus sur Operators and Elementary Operations dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!