LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Unit in Format into String

Solved!
Go to solution

Hi All,

 

If a control already has a unit, and we pass it to a format into string function, its not displaying the same exact unit. For example, below the control has unit of "g", while the format string has unit of "kg". 

 

Format Into String Unit.png

  1. Is there any way to make the format into string take the exact unit specified in the control?
  2. Is there any way to remove the unit in the format into string function, even when the numeric control input has a unit specified?

Attached VI in 2010 format.

 

Thanks,

Karthik

 

------
Using LabVIEW since 2012. Certified LabVIEW & TestStand Architect
0 Kudos
Message 1 of 6
(4,933 Views)

Read the help for the format specifier.

 

1.  Use %{g}f to make it look like grams.

2.  Put a convert Unit function containing g on the wire going to the format into string function.

0 Kudos
Message 2 of 6
(4,915 Views)
Solution
Accepted by topic author Karthik_Abiram
Not automatically, no. The problem is that the unit designation in a control only effects how the data is displayed in that one particular control. When you wire a value with units to a format to string node it will express the value in the base unit for the wire.

Mike.

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
Message 3 of 6
(4,913 Views)

Ravens,

I did read the LabVIEW help, and knew of explicitly mentioning the unit in format specifier. I was just wondering if it is possible to take the unit specifed in the control automatically, without explicitly mentioning it in the format specifier.

 

Mike,

Thanks, that answers my question.

------
Using LabVIEW since 2012. Certified LabVIEW & TestStand Architect
0 Kudos
Message 4 of 6
(4,897 Views)
Solution
Accepted by topic author Karthik_Abiram

It wasn't clear from your message what you were ultimately trying to do.

 

You can "automatically" take the unit specified in the control along with the unit specification for a format into string like I called out.  Use the UnitLabel.Text to build a format string code to convert the string.

 

See attached.

Message 5 of 6
(4,886 Views)

Ravens,

 

Sorry if I wasn't clear. The solution you suggested seems to be a good work around for what I wanted to do.Thanks!

------
Using LabVIEW since 2012. Certified LabVIEW & TestStand Architect
0 Kudos
Message 6 of 6
(4,880 Views)