07-05-2012 02:16 AM
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
07-05-2012 02:25 AM
Hi pramod,
See the attached VI.You can use this as a sub VI.
07-05-2012 02:25 AM
07-05-2012 02:26 AM
Hi,
I am using labview 8.6, unable to open the VI 😞
07-05-2012 02:27 AM
Thanks a lot 🙂
07-05-2012 02:29 AM
For integer numbers you could convert number in string (for example format into string using %d in format) and get string length
07-05-2012 02:31 AM
What about 1.23 or 1,23 as input? The length could be 1 or 2 or 3 or even 4.
Christian
07-05-2012 02:47 AM - edited 07-05-2012 02:47 AM
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). 😄
07-05-2012 09:01 AM
If the number is in a control or indicator, you can do it like this:
02-01-2020 03:08 PM - edited 02-01-2020 03:29 PM
@paul_a_cardinale wrote:
If the number is in a control or indicator, you can do it like this:
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.