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

1 visualización (últimos 30 días)
i have an value as 6.5.give me the syntax to get the whole number 6

Respuesta aceptada

Azzi Abdelmalek
Azzi Abdelmalek el 1 de Nov. de 2012
Editada: Azzi Abdelmalek el 1 de Nov. de 2012
a=6.5
fix (a)
% for other rounding look at round, ceil command

Más respuestas (1)

Image Analyst
Image Analyst el 1 de Nov. de 2012
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

Categorías

Más información sobre Clocks and Timers en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by