06-05-2014 05:01 PM
Hi,
I am trying to make an applicaiton that the user can select the units on the controls/indicators. I will be logging data from those indicators to a data file. I want to give them the freedom to select any units they want (as long a LabVIEW supports them) and then based on that unit selection the save data file will reflect that unit selection. I realize I could do this using case structures but it would be a huge ordeal dealing with all the different types of unit selections possible. I've attached a vi which is close to what I want to do but for some reason the units get converted to meters even though my constant has no units.
Thanks!
Solved! Go to Solution.
06-05-2014 06:08 PM - edited 06-05-2014 06:09 PM
LabVIEW stores the value of a number with attached unit always in the base unit and only converts to the selected unit and back when displaying/entering the value.
However you may be able to use VI Server properties of the control to read the actual text value of the control and store that to the file.
06-05-2014 09:36 PM - edited 06-05-2014 09:42 PM
Welcome to the spooky world of LabVIEW units. Many of the developers here have tried using them for a while, then got burned by some ugly bugs and caveats.
Check out this thread for a small dose of things to look out for.
Here's a snippet of a classic.
Note the units on the indicators!
06-05-2014 11:35 PM
Hi Ryman,
If you want the user to select the units and that unit selection should be a part of control/indicator,then you have to create a xcontrol which is another way to creating an advanced controls/indicators.
For more information on xcontrols refer: http://www.ni.com/white-paper/3198/en/
Regards,
SrikrishnaNF
06-06-2014 08:18 AM
Awesome rolfk that worked. I tried that before except I fed it the value not the number.text property. Thanks!
Thanks for all the others who posted I will be careful I have worked with units before with only a little bit of trouble hopefully things will go smoothly from here on out.