Effacer les filtres
Effacer les filtres

How to remove zero from float value.?

2 vues (au cours des 30 derniers jours)
Mira le
Mira le le 18 Juin 2023
Modifié(e) : VBBV le 18 Juin 2023
Hello everyone
I have a problem I would like to help me solving it
i have float value when I make division opeation and I obained value like this: 0.9093 0.9074 0.9014
I use round but I got: 0.9000 0.900 0.900 0.900
Iwant to remove these zeros to be 0.9 0.9 0.9 0.9
Thank you

Réponse acceptée

VBBV
VBBV le 18 Juin 2023
Modifié(e) : VBBV le 18 Juin 2023
x = [0.9093 0.9074 0.9014]
x = 1×3
0.9093 0.9074 0.9014
vpa(round(x,1),2)
ans = 
  1 commentaire
VBBV
VBBV le 18 Juin 2023

Use vpa with round to get the decimal precision you want. By default Matlab uses 4 decimal places for floatpoint numbers

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Produits


Version

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by