how can I delete zeros after virgule?

1 visualización (últimos 30 días)
Mira le
Mira le el 15 de Jun. de 2023
Editada: Stephen23 el 15 de Jun. de 2023
hello
I have vector with values
0.254 0.435
I want to be 0.2 0.4

Respuesta aceptada

Matt J
Matt J el 15 de Jun. de 2023
floor([0.254 0.435]*10)/10
ans = 1×2
0.2000 0.4000
  2 comentarios
Mira le
Mira le el 15 de Jun. de 2023
thank you for your answer
but how keep just 0.2 0.4
remove zeros.
Stephen23
Stephen23 el 15 de Jun. de 2023
Editada: Stephen23 el 15 de Jun. de 2023
"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.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Logical en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by