i have an value as 6.5.give me the syntax to get the whole number 6
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
i have an value as 6.5.give me the syntax to get the whole number 6
0 commentaires
Réponse acceptée
Azzi Abdelmalek
le 1 Nov 2012
Modifié(e) : Azzi Abdelmalek
le 1 Nov 2012
a=6.5
fix (a)
% for other rounding look at round, ceil command
Plus de réponses (1)
Image Analyst
le 1 Nov 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
0 commentaires
Voir également
Catégories
En savoir plus sur Solver Outputs and Iterative Display dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!