フィルターのクリア

How to check decimals of a number in MATLAB?

98 ビュー (過去 30 日間)
Ivan Mich
Ivan Mich 2022 年 10 月 12 日
編集済み: Ivan Mich 2022 年 10 月 12 日
Hello,
I have a question about a code. I would like to check if a value has a decimal equal to 0.5 (e.g., 5.5, 7.5 etc. ) or has a decimal equal to 0 (zero) (I mean to be integer, for example 7,5,6 etc. ).
Which command should I use? Could you please help me?

採用された回答

KSSV
KSSV 2022 年 10 月 12 日
x = 5.5
x = 5.5000
integ = fix(x)
integ = 5
frac = mod(abs(x),1)
frac = 0.5000

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeNumeric Types についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by