how to prin only integer value in matlab ?

160 ビュー (過去 30 日間)
Bojan
Bojan 2014 年 5 月 16 日
回答済み: Azzi Abdelmalek 2014 年 5 月 16 日
Hello guys, I need some help. I have two output values, etc:
avg=num/2
avg2=num2/2
and first value is for example 94, other 93.5, I need other value to be 94 or 93 not 93.5, can anyone help me ? thanks !

回答 (2 件)

Azzi Abdelmalek
Azzi Abdelmalek 2014 年 5 月 16 日
use
round(93.5)
Or
floor(93.5)
or
ceil(93.5)

Jos (10584)
Jos (10584) 2014 年 5 月 16 日
Is this only for display purposes?
x = 1/7
disp(x)
disp(fix(x))
disp(floor(x))
disp(num2str(x,'%.0f'))

カテゴリ

Help Center および File ExchangeFourier Analysis and Filtering についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by