how can I delete zeros after virgule?

1 次查看(过去 30 天)
hello
I have vector with values
0.254 0.435
I want to be 0.2 0.4

采纳的回答

Matt J
Matt J 2023-6-15
floor([0.254 0.435]*10)/10
ans = 1×2
0.2000 0.4000
  2 个评论
Mira le
Mira le 2023-6-15
thank you for your answer
but how keep just 0.2 0.4
remove zeros.
Stephen23
Stephen23 2023-6-15
编辑:Stephen23 2023-6-15
"but how keep just 0.2 0.4 remove zeros."
Perhaps FORMAT does what you want:
format short
0.2
ans = 0.2000
format short G
0.2
ans =
0.2
Of course, that makes absolutely no difference to the value stored in memory.

请先登录,再进行评论。

更多回答(0 个)

类别

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

标签

产品


版本

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by