LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to convert a double to a string?

Solved!
Go to solution
Highlighted

Using NXG.

I see Number to Decimal String. When I feed this a value of 123.45 I get string that is only whole digits - 123. I see a little conversion warning when I wire a decimal type to this block.

 

Image 3.png

Is there a block for converting Decimal to string?

0 Kudos
Message 1 of 6
(264 Views)
Highlighted

Hi flycast,

 

in classic LabVIEW the function is called FormatIntoString. Or NumberToFractionalString…

 

Does NXG provide the same functions?

 

Why do you use a function named "Decimal" for "fractional" numbers?

Best regards,
GerdW

using LV2011SP1 + LV2017 (+LV2020 sometimes) on Win10+cRIO
Message 2 of 6
(259 Views)
Highlighted

@flycast wrote:

Is there a block for converting Decimal to string?


Common mistake.  "Decimal" in this case is to imply an integer.  As stated, you should be using "Number To Fractional String" or something similarly named.


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
Message 3 of 6
(254 Views)
Highlighted
Solution
Accepted by flycast

@GerdW wrote:

Hi flycast,

 

in classic LabVIEW the function is called FormatIntoString. Or NumberToFractionalString…

 

Does NXG provide the same functions?

 

Why do you use a function named "Decimal" for "fractional" numbers?


Hi Gerd,

 

That is a very common mistake.   Because in the regular English language, Decimal doesn't imply integers.  When you hear "decimal" most people think of values after the decimal point.

 

When you hear "fractional", you think of fractions like 1/2,  2/3,  3/4.    Not "decimal" numbers like 0.5, 0.75,  1.82, etc.

 

NI should have named those functions more clearly in LabVIEW a long time ago. So I completely understand why the original poster and dozens to hundreds of others through the years have made the same mistake.

 

To flycast, the way NI has used "decimal" on these functions was to represent the decimal numbering system (base 10), as opposed to binary, octal, and hexadecimal.  (Bases 2, 8, and 16).  More of a computer engineering definition for decimal rather than the common world definition.

Message 4 of 6
(245 Views)
Highlighted

@crossrulz wrote:
As stated, you should be using "Number To Fractional String" or something similarly named.

It is named exactly that ;).

 

altenbach_0-1603737616072.png

 


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
Message 5 of 6
(237 Views)
Highlighted

Yep! Thank you, that is it.

0 Kudos
Message 6 of 6
(233 Views)