How to keep decimal float point only

I could not find any answer about this. So I have a float number (a=323.153), I wanna output look like this with keeping decimal point only:
>> a=323.
What format shall I use?
Thanks.

 Respuesta aceptada

Robert U
Robert U el 3 de Feb. de 2021
If it is just for display you can specify the output format in fprintf.
a = 323.153;
fprintf('<< a = %.0f.\n',a)
output:
<< a = 323.
Kind regards,
Robert

Más respuestas (1)

Walter Roberson
Walter Roberson el 3 de Feb. de 2021

0 votos

https://www.mathworks.com/help/matlab/ref/fix.html

2 comentarios

JZ
JZ el 3 de Feb. de 2021
Thanks, Walter.
It's not exactly what I need. I need output with a dot, so (>>a=323.).
Alex Alex
Alex Alex el 3 de Feb. de 2021
Convert to string format and add point manually?

Iniciar sesión para comentar.

Categorías

Productos

Versión

R2017a

Etiquetas

Preguntada:

JZ
el 3 de Feb. de 2021

Comentada:

JZ
el 3 de Feb. de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by