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!