Function that returns value after decimal point?
显示 更早的评论
Is there a function that returns the value after the decimal?
EX:
a = 2.876
function(a) = 0.876
Thank You
采纳的回答
更多回答(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 个评论
Jan
2012-10-4
What happens for integer values?
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
类别
在 帮助中心 和 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!