BreakPoint

cancel
Showing results for 
Search instead for 
Did you mean: 

Rube Goldberg Code

Sorting a 1-D array is the theory as to what this person is trying to do.  A huge VI with 1024 constants all explicitly created, the corresponding wires and a subVI.  Really no way to display this, so look at the image relative to the navigation window.

 

Seen here

The wire organization is pretty remarkable.

 

0 Kudos
Message 1811 of 2,565
(11,256 Views)

If it makes you feel any better I previously answered one of their questions about scripting an inplace element structure so the whole thing is likely scripted.

Matt J | National Instruments | CLA
Message 1812 of 2,565
(11,240 Views)

You must've done a good job answering that question because they must've put together a pretty good script.

If only their "logic" skills matched their scripting skills.  (As in, is it logical to be doing something this way?)

Message 1813 of 2,565
(11,234 Views)

Aah, Dark Star.  Great film.

Message 1814 of 2,565
(11,186 Views)

User apparently never saw build array.  Instead uses Initialize Array to create a 0 element 0 array (but proceeds to comment it saying it is a 1 element array ??).  Then uses Insert Into Array to put new elements at the beginning of the empty array.  And for good measure, let's just index out one of the elements we just put in.

 

Seen here  http://forums.ni.com/t5/LabVIEW/How-do-I-make-elapsed-time-agree-with-real-time-in-my-waveform/m-p/3...

 

0 Kudos
Message 1815 of 2,565
(11,079 Views)

This person has heard of Build Array, but apparently only knows how to build onto the front of the array and stores it in a shift register.  So they need to flip the 1-D array.  Then take the i-th element of that flipped array, which would happen to be the same value the just put into the array.

 

Seen here.  http://forums.ni.com/t5/LabVIEW/GPIB-to-RS-232-Transition/m-p/3600633/highlight/false#M1008961

 

Message 1816 of 2,565
(11,080 Views)

Haven't seen that in a while (seen here).

 

 

 

A picture tells 50%, but you can probably guess what's in the FALSE case ....

Yes, its a FALSE diagram constant, nothing else. 😄

 

I wonder what would happen of we would remove the entire case structure and just leave a plain boolean wire. The code would work exactly the same.

Message 1817 of 2,565
(10,983 Views)

(seen here)

 

The attached VI at the above link is a goldmine for Rube Goldberg code. Just study it an you'll get a "shakes head" moment every couple of seconds. 😄

 

Anyway, there are three inner while loops and all use the same stopping mechanism as follows. To process all rows (+1), we index into the 2D array using the iteration terminal and stop the loop if an empty array is returned as row because we have run out of rows. Here's a small fragment.

 

0 Kudos
Message 1818 of 2,565
(10,914 Views)

I found this interesting bit in some legacy code today.  We have a bunch of this type of construct floating around, since this code was written before the event structure was introduced, but I don't remember seeing it used with one item, or without polling button presses.

rg.png

 

 

The typical usage pattern is more like this.

rg2.png

--
Tim Elsey
Certified LabVIEW Architect
Message 1819 of 2,565
(10,669 Views)

That was THE way to do it prior to the event structure. "Catching" the button punch was actually a challenge. I actually had re-use code to support the button to state conversion. I re-used it once and then the Event Structure was introduced. Imagine polling the user interface...

 

We have come a long way baby.

 

Ben

 

 

 

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 1820 of 2,565
(10,639 Views)