From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
05-11-2009 02:56 PM
There was a lot of buzz over on LAVA last week regarding some neat LabVIEW behavior that I assumed everybody already knew. So here's a nugget to make it official.
When you drop a Numeric Constant on the block diagram (my Quick Drop shortcut for numeric constant is 'nc'), its data type is I32. If you want to change the data type to DBL, you don't have to go through the Right-click > Representation menu. Instead, simply type a value in the constant that has a decimal point in it. Even if you don't want to specify a fractional value, but you still want to change the data type, just end your number with a decimal point. For example, if you drop the constant, and you want it to have a DBL value of "1", then just type "1." into the constant, and there you go...blue to orange in the blink of an eye!
05-11-2009 02:58 PM
05-11-2009 02:58 PM
lol that one of the first things i learned with labview 🙂
05-11-2009 03:11 PM
Harold Timmis wrote:lol that one of the first things i learned with labview 🙂
That's funny. That is the most recent thing I've learned with LabVIEW.
I hadn't heard about this one before and is so simple, but good to know.
05-11-2009 03:13 PM
Darren wrote:Even if you don't want to specify a fractional value, but you still want to change the data type, just end your number with a decimal point.
Yes, use it all the time. Has been around forever. (Just tried in LabVIEW 4.0.1 and it works) 😄
Here's a wish for improvent: Once I do this, I would prefer if "adapt to datatype" would become disabled. Right now, everything can be nicely wired up in all orange, but if I then change the constant to e.g. 2, it turns blue and forces coercion dot. I need to remember to enter the decimal point every time I edit the constant.
LabVIEW should be smart enought to not automatically change the datatype if a coercion would result. 🙂
05-11-2009 03:39 PM
yeah my manager taught me it.
05-11-2009 04:03 PM
05-11-2009 04:08 PM
05-11-2009 04:12 PM
Thoric wrote:
Any way to easily change the representation from I32 to, say, U16 ?
Other than using the right-click Representation menu, not really. I would look for another U16 data type (wire, terminal, constant,etc.) and right-click > Create Constant I guess.
-D
05-11-2009 05:26 PM