How to round only two values after decimal point

5 visualizaciones (últimos 30 días)
Akshay Math
Akshay Math el 1 de Mzo. de 2020
Comentada: stozaki el 1 de Mzo. de 2020
Hi guys,
I have following block set up and i want 24.02==24.021 but i am getting output as 0 so how can i round the input to consider only two values after decimal point.

Respuesta aceptada

Akshay Math
Akshay Math el 1 de Mzo. de 2020
First multiply with 100 for two values after decimal then convert into integer and divide by 100.

Más respuestas (1)

stozaki
stozaki el 1 de Mzo. de 2020
You can use 'round' block and 'subtract' block.
  4 comentarios
Akshay Math
Akshay Math el 1 de Mzo. de 2020
Thanks stozaki, however this worked for me
First multiply with 100 for two values after decimal then convert into integer and divide by 100.
stozaki
stozaki el 1 de Mzo. de 2020
@ Akshay
Thank you for trying the data type conversion block. I understand that the location of the binary points was different because you were using a Gain block.
Regards,
stozaki

Iniciar sesión para comentar.

Categorías

Más información sobre Measurements and Statistics en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by