BreakPoint

cancel
Showing results for 
Search instead for 
Did you mean: 

Rube Goldberg Code

To programmatically change a numeric control, one solution would be to format the desired value to a string, then write to the NumText.Text property. To confuse things even more, we change the label of the property node so it differs from the control (it points to "Number").

 

 

(seen here)

 

Message 711 of 2,571
(11,422 Views)

At first I thought you made that one yourself! Since i joked about transforming to strings when we talked the worst possible way to update a control about a week ago! Smiley Surprised

 

Truth is stranger than fiction, indeed.

 

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 712 of 2,571
(11,339 Views)

A new meaning for "Vestigial For Loop" was created here on an otherwise impressive-sounding test:

 

17853i460CEB5DD30A91B3

 

(For reference, a "Vestigial For Loop" may safely be removed by leveraging scalar/array polymorphism of the primitives inside the loop, resulting in no difference in the output of the code. However, an astute programmer will realize that performance varies between the two, and one method will provide better efficiency based on the size of the array. Laymen such as myself need not sweat such niggles, however: this only becomes relevant when squeezing out highest performance possible from a system with either limited RAM or CPU. Here's an example of a legitimate Vestigial For Loop: 

 

17851i8CD583FDCD2C9240

)

0 Kudos
Message 713 of 2,571
(11,294 Views)

From the same VI, a few WEQs:

 

17855i547553ABD6EDEBFC

0 Kudos
Message 714 of 2,571
(11,290 Views)

 


@JackDunaway wrote:

 

(For reference, a "Vestigial For Loop" may safely be removed by leveraging scalar/array polymorphism of the primitives inside the loop, resulting in no difference in the output of the code.


 

... Not to be confused with vestigial while loops. 😄

 

Message 715 of 2,571
(11,272 Views)

Speak of the devil...

 

18081i8F1ECF4E80CD693A

Richard






0 Kudos
Message 716 of 2,571
(11,198 Views)

Here's one way to get the number of rows in a 2D array:

 

 

A simple "index array" on the array size output with the index unwired would do the same things....

 

(seen here inside "save data.vi" . As a bonus, try to find a way to eliminate the three local variables 🐵

0 Kudos
Message 717 of 2,571
(11,157 Views)

Sometimes it is interesting to look inside vi.lib for some baffling rube goldberg code sighting.

 

Have a look at "Newton raphson Inner Part numeric derivate.vi" (called inside newton raphson zero finder (VI model))

or "Newton Raphson Inner Part.vi" ( called inside newton Raphson Zero finder (formula)).

 

(See code fragment in upper part of image)

 

You would think there should be an easier way to divide a value by two, one possible alternative is shown in the lower part of the image.

 

I can only imagine that this code is from the stone ages of early labview ... Is there any other explanation?

 

Yes, the two algorithms are not entirely equivalent: The only difference I can tell, is that the upper version is more limited, because it blows up for negative inputs, so it only works for about 50% of all numbers. However, the calling program already checks for positive conditions of "h", so we won't need to worry about that here.. 😉

Message 718 of 2,571
(11,049 Views)

I have been warning about the pitfalls of the NR method with numerically calculated derivatives for quite some time now.  And that was before I realized they went and Rubed it as well.  Smiley Very Happy

 

I tried to give the benefit of the doubt and see if that was some clever way of keeping precision, but it doesn't seem to be.  Besides, division is not really a precision killer.  I think someone was just a little goofy.

Message 719 of 2,571
(11,032 Views)

A classic one...18563i369613CEFB7402C3 

found here

Chilly Charly    (aka CC)

         E-List Master - Kudos glutton - Press the yellow button on the left...
        
Message 720 of 2,571
(11,004 Views)