i have an value as 6.5.give me the syntax to get the whole number 6

4 ビュー (過去 30 日間)
Benitta glara
Benitta glara 2012 年 11 月 1 日
i have an value as 6.5.give me the syntax to get the whole number 6

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2012 年 11 月 1 日
編集済み: Azzi Abdelmalek 2012 年 11 月 1 日
a=6.5
fix (a)
% for other rounding look at round, ceil command

その他の回答 (1 件)

Image Analyst
Image Analyst 2012 年 11 月 1 日
Do you want a floating point number or an integer? Here it is both ways:
v = 6.5;
vDouble = floor(v)
class(vDouble)
vInt = int32(floor(v))
class(vInt)
In the command window:
vDouble =
6
ans =
double
vInt =
6
ans =
int32

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by