LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Control number of digits using format function

Solved!
Go to solution

Hello,

Please, I am trying to control the number of digits using format function and Format Specifier.

I acquired data using data acquisition. I got a number such as 1654.1876872. I want to get only two digits after comma such as 1654.18

 

I attached sample of the Vi which I tried but it's not working correctly

 

Thanks

 

 

 

 

0 Kudos
Message 1 of 4
(2,553 Views)

Try "%.02f" for the format string.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 4
(2,531 Views)

Hello,

Thank you for your reply. Please, I tried it but its still not working

I attached the Vi

 

Thanks

0 Kudos
Message 3 of 4
(2,521 Views)
Solution
Accepted by topic author Ke_Zank

Read the detailed help for that function.  You have nothing wired into value.  Your "value" is a string you wired into the prepend string input.  If your "value" is a string, you need to convert it to a number and back to a string.

 

Format Into String is much more commonly used than Format into Value.  For one, it lets you format multiple values into a single string if you need to.

 

0 Kudos
Message 4 of 4
(2,514 Views)