From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

BreakPoint

cancel
Showing results for 
Search instead for 
Did you mean: 

Why some people say Local Variables are bad...

It's like instantiateing 50 variables in text, and then never using them.

 

String TestType = new String("TestType");

String IndividualFault = new String("IndividualFault");

....

....

String CollectedData = new String("CollectedData");

 

I remember once getting frustrated with all the wires on my block diagram going all over the place.  So I aligned all my wires horizontally so they were all exactly on top of each other.  I thought that look was cleaner because instead of having 20 wires go from left to right there was just one, with 19 others behind it.  We all did crazy things when we were first learning.

Message 391 of 395
(5,146 Views)

In my first VI I wanted to deal with all of the wires but nobody in the lab knew how to make a cluster. I created a sub-VI from a bunch of the code that required the worse case connector pane. It looked like spider.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 392 of 395
(5,135 Views)

@Hooovahh wrote:

 

I remember once getting frustrated with all the wires on my block diagram going all over the place.  So I aligned all my wires horizontally so they were all exactly on top of each other.  I thought that look was cleaner because instead of having 20 wires go from left to right there was just one, with 19 others behind it.  We all did crazy things when we were first learning.


Don't think you are allone.

Day ONE, I was given a look at LabVIEW, Shown haw to use the tools, Functions, and Controls panels and was told to just build anything.  I did use subvis to keep my BDs clean, HOWEVER ---(pause for effect.)

Spoiler
No-one told me about the con pane  so I passed all data on globals.  Race conditions were solved by the ecpedient use of stacked sequence structures-  Hey, it worked!  In my defense, remember the con pane wasn't visable unless you knew where to right-click on the vi icon

 


"Should be" isn't "Is" -Jay
Message 393 of 395
(5,071 Views)

I didn't know if this belongs in Local Abuse or Flat sequence structure abuse. But here's one snippet of code seen here:

 

Railroaded.png

Certified-LabVIEW-Architect_rgb.jpgCertified_TestStand_Architect_rgb.jpg


"I won't be wronged. I won't be insulted. I won't be laid a-hand on. I don't do these things to other people, and I require the same from them." John Bernard Books

Message 394 of 395
(4,854 Views)

@bsvare wrote:

I didn't know if this belongs in Local Abuse or Flat sequence structure abuse. But here's one snippet of code seen here:


Programmed like a true text programmer: First define all "variables" and then use value property nodes for everything 😄 Sigh!

 

 Lets look on the left...

 

(Also note that read from spreadsheet file could just read the first colum as a 1D array (set transpose to true), simplifying the indexing dramatically.)

 

Message 395 of 395
(4,830 Views)