09-06-2012 01:02 PM
Hi, I was wondering if there was a way to assign terminals of names to connect them to each other, rather than wires. That way there can be a "wireless" connetion between different elements. You can do this in various circuit simulation programs, just wondering if this was possible in LabVIEW? Thanks for the help.
09-06-2012 01:20 PM
Yes, it's called Local Variables, and no, you shouldn't use them to make your diagram look better. Showing the wired connection has a very good purpose. There's lots of threads in these forums about coding styles, I'm a better programmer for reading through them, recommend them to anyone.
09-06-2012 01:24 PM
@taper wrote:
There's lots of threads in these forums about coding styles...
Like this one (specific to local variables): http://forums.ni.com/t5/BreakPoint/Why-some-people-say-Local-Variables-are-bad/td-p/711239
09-06-2012 01:31 PM
Ok thanks. I was interested in doing it to clean up my program a little bit. I actually figured it was equally as confusing to read code that has wires going every which way. Now that I know it is the standard around here, I will stay away. Thanks.
09-06-2012 02:21 PM
@baseball07 wrote:
Ok thanks. I was interested in doing it to clean up my program a little bit. I actually figured it was equally as confusing to read code that has wires going every which way. Now that I know it is the standard around here, I will stay away. Thanks.
Stay away from LabVIEW or local variables? Unfortunately there is no shortage of poorly written LabVIEW code (as well as most other programming languages) that is a pain to look at. However with good programming practices and good style LabVIEW code can be very clean and easy to read. If your diagram is a mess of wires that generally indicates a poor design or the wrong architecture for the problem.
Now if you are saying you will stay away from local variables that is a good idea. As mentioned, there are volumes written about why overusing local variables is a bad thing. One of the biggest reasons is that they introduce race conditions.