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

 Accepted Answer

More Answers (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

Categories

Find more on Aerospace Blockset in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!