How to remove zero from float value.?

6 次查看(过去 30 天)
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

采纳的回答

VBBV
VBBV 2023-6-18
编辑:VBBV 2023-6-18
x = [0.9093 0.9074 0.9014]
x = 1×3
0.9093 0.9074 0.9014
vpa(round(x,1),2)
ans = 
  1 个评论
VBBV
VBBV 2023-6-18

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

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Mathematics 的更多信息

标签

产品


版本

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by