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!