LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Number divide by 100 then convert to string

Hello,

 

How do take a number divide by 100 then convert to string. I am trying to find the most efficient way to do this? The divide function can only work on doubles it would appear or am I wrong?

 

Nevica

0 Kudos
Message 1 of 14
(3,033 Views)

You can do a normal divide and convert back to integer, or just pass into the decimal to string conversion.

 

If you know you won't hve remainders, or don't care, then use the Quotient and Remainder VI, and everything will stay as an integer, then use the decimal to string conversion.

0 Kudos
Message 2 of 14
(3,020 Views)

The normal divide function produces a double type. When I convert to a 'string with number to decimal string' it shows a red dot on the little icon. Obviously this red dot shows that a type conversion is happening. Is this a problem or is it just a warning?

 

Nevica

0 Kudos
Message 3 of 14
(3,013 Views)

It's a warning that you have mismatched data types and LabVIEW is coercing the data from a DBL to an integer.  In some situations, this may lead to data loss.  In your case, it will be rounding the data.

0 Kudos
Message 4 of 14
(3,010 Views)

Ok, I don't want whole division so how do I get around this problem?

0 Kudos
Message 5 of 14
(3,007 Views)

Hello nevica,

 

There is a palette in LabView that contains a number of subVIs to convert a number into a string.

 

This can be found going into the palettes and following Programming>>String>>String/Number Conversion

 

I've also attached an example program that can show you the difference between them and how the created strings are formatted.

 

Let me know if this solves your problem.

 

Regards

James W
Controls Systems Engineer
STFC
0 Kudos
Message 6 of 14
(3,005 Views)

Use use the Quotient and Remainder VI I mentioned in my first post.  It will keep the integer as an integer.  The quotient will be the result you want.

0 Kudos
Message 7 of 14
(3,001 Views)

Here is where I am at with this problem. (see attachment).

 

 

The output number of the et3500.vi produes a whole number. When divided by 100 it will produce a decimal number. Are you saying that the the division process of the 'number types' is such that it can only produce a whole number or will I get a decimal number after the division. 

 

I am just trying to undersatnd how Labview works!

 

Nevica

Capture.JPG

0 Kudos
Message 8 of 14
(2,993 Views)

As I have mentioned in two posts now, use the VI I told you to use.  I have provided a VI which calls the VI I mentioned.  This will truncate any remainder from your division. and output an integer instead of a DBL.

0 Kudos
Message 9 of 14
(2,987 Views)

Ok, I see. Thanks for your patience!!

0 Kudos
Message 10 of 14
(2,984 Views)