From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

rounding inputs

hi
i have an input reading voltage as e.g. 1.25634785 how do i round the number so it goes to 1.26 for the rest of my code?
0 Kudos
Message 1 of 3
(2,255 Views)
Hi

One simple solution was to multiply the value with a constant, round it and divide it by the same constant as before.

Just have a look at the example.

Hope this helps.

Thomas
Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
0 Kudos
Message 2 of 3
(2,250 Views)
Hello,

Multiply it by 100, round it to the nearest integer and then divide it by 100.

Hope this helps,
Paulo
0 Kudos
Message 3 of 3
(2,249 Views)