Function that returns value after decimal point?
조회 수: 1 (최근 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!