Function that returns value after decimal point?
8 次查看(过去 30 天)
显示 更早的评论
Is there a function that returns the value after the decimal?
EX:
a = 2.876
function(a) = 0.876
Thank You
0 个评论
采纳的回答
更多回答(1 个)
Azzi Abdelmalek
2012-10-4
编辑:Azzi Abdelmalek
2012-10-4
out=a-fix(a)
%or
A=num2str(a);
out=str2num(['0' A(strfind(A,'.'):end)])
2 个评论
Azzi Abdelmalek
2012-10-4
编辑:Azzi Abdelmalek
2012-10-4
a=1
a-fix(a)=0
and
A=num2str(a);
out=str2num(['0' A(strfind(A,'.'):end)])=0
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Operators and Elementary Operations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!