LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Convert 1.235G to display 1235M

How do I display the number 1.235G as 1235M in a string display ?

I also need to retrieve the value

 

 

Keith

0 Kudos
Message 1 of 6
(2,559 Views)

@DeOdderKeith wrote:

How do I display the number 1.235G as 1235M in a string display ?

I also need to retrieve the value

 

 

Keith


Search for the dot and the letter G. Remove dot, replace G with M. Finally, use the string to decimal number function to get the value...

You can do these steps in many variations, very simple. You can even play with the string functions which use regular expressions, so you could do what you want in a single step...

What did you try so far?

0 Kudos
Message 2 of 6
(2,537 Views)

Hi Keith,

 

use ScanFromString and FormatIntoString:

check.png

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 3 of 6
(2,521 Views)

Thanks for the responses, however, this does not preserve the value of the original number.

I need to extract the number from the resulting string at a later time. Also, this value is written into a database, so future users will need to have the correct value

 

I've tried various formatting techniques, but all seem to change the original value.

 

I am looking for an automated way of displaying 1.235G as 1235M

 

Keith

0 Kudos
Message 4 of 6
(2,510 Views)

Hi Keith,

 

however, this does not preserve the value of the original number.

Why not?

My snippet scans the number and reformats it according to your requirement.

Can you attach a VI showing the problem of "not preserving the value"?

 

I need to extract the number from the resulting string at a later time.

Why don't you keep the original string/value instead of the "resulting string"?

 

I've tried various formatting techniques, but all seem to change the original value.

What have you tried? Can you attach your VI?

Why don't you keep the "original value" and only change the value for this string display?

 

I am looking for an automated way of displaying 1.235G as 1235M

See my snippet…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 5 of 6
(2,505 Views)

You are CORRECT.

 

My Mistake. I did not try to run your code...

 

 

Kudos

 

Solution

0 Kudos
Message 6 of 6
(2,500 Views)