LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to find the length of a number in labview?

Hi All,

 

I am Pramod from Bangalore.

 

I needed to know is their any VI which calculates the length of a number.

 

For example, for the number 1000, length is 4. Similary i need it to be calculated automatically in VI, instead of entering manually.

 

Regards,

Pramod M G

0 Kudos
Message 1 of 13
(6,562 Views)

Hi pramod,

                 See the attached VI.You can use this as a sub VI.

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Thanks as kudos only:)
Message 2 of 13
(6,551 Views)

number length.png

Message 3 of 13
(6,550 Views)

Hi,

 

I am using labview 8.6, unable to open the VI 😞

0 Kudos
Message 4 of 13
(6,546 Views)

Thanks a lot 🙂

0 Kudos
Message 5 of 13
(6,544 Views)

For integer numbers you could convert number in string (for example format into string using %d in format) and get string length

0 Kudos
Message 6 of 13
(6,538 Views)

What about 1.23 or 1,23 as input?  The length could be 1 or 2 or 3 or even 4.

 

 

Christian

0 Kudos
Message 7 of 13
(6,533 Views)

If I understand you right, the input is restricted to positive integers. (if you allow negative numbers, zero, or fractions, you need to define what results you want).

 

For positive integers inputs, here's a mathematical solution (but the formatting solutions above are probably simpler). 😄

 

 

0 Kudos
Message 8 of 13
(6,526 Views)

If the number is in a control or indicator, you can do it like this:

Num_Len.png

Message 9 of 13
(6,475 Views)

@paul_a_cardinale wrote:

If the number is in a control or indicator, you can do it like this:

Num_Len.png


I wouldn't account that as solution for floating point numbers. It will only depend on the selected display format and has almost nothing to do with the actual number.

 

e.g 1.0 with a display format of 10 digits after the comma will result in 12. Doesn't seem very useful to me.

Rolf Kalbermatter
My Blog
0 Kudos
Message 10 of 13
(4,423 Views)