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.

BreakPoint

cancel
Showing results for 
Search instead for 
Did you mean: 

Rube Goldberg Code


JW-JnJ wrote: 

 

Wouldn't it be better to just bundle all of the objects you want sorted in with the initial cluster?


That's one method, and honestly I'm not sure which I prefer.  From a readability stand point I think the OpenG method makes more readable code.  And from development time I think the OpenG method is faster to write, and takes less clicks.  From an execution stand point I'm sure the OpenG method is slower.  

 

Sort Examples.png

 

One reuse function this exercise did make me think about writing, is a VI that sorts an array of cluster, based on an element in that cluster.  Because sure some times I have two 1D arrays one of string one of double.  But some times I have a 1D array of cluster, which contains two scalar elements a string and a double.  And a reuse VI could be written that sorts that array of cluster based on the scalar data.

0 Kudos
Message 1631 of 2,571
(10,854 Views)

@Hooovahh wrote:
One reuse function this exercise did make me think about writing, is a VI that sorts an array of cluster, based on an element in that cluster...And a reuse VI could be written that sorts that array of cluster based on the scalar data.

Because the sort 1D array doesn't work on a variant, or on a cluster where the first element is is a variant, this would have to be done using an XNode.  Still possible if someone feels like a fun exercise.

 

Edit: nevermind I think you could do it with variants for the common data types.

0 Kudos
Message 1632 of 2,571
(10,811 Views)

To calculate a mathematically simple (1220 * (x+1)) scalar output from a scalar input, we apparently need a FOR loop and briefly create an array. (seen here)

 

0 Kudos
Message 1633 of 2,571
(10,632 Views)

Let's keep a history of waveforms in an array the hardway by storing in a shift register with 30 element history, and then building them all up into a 1-D array every iteration.

 

Seen here.

 

 

Message 1634 of 2,571
(10,598 Views)

Brief review of boolean logic:

 

What is the output as a function of the error status?

 

 

 

 

(seen here)

0 Kudos
Message 1635 of 2,571
(10,331 Views)

@altenbach wrote:

Brief review of boolean logic:

 

What is the output as a function of the error status?

 

 

 

 

(seen here)


Are we to assume that the shown case is the one one that is firing with the case structure?

0 Kudos
Message 1636 of 2,571
(10,314 Views)
I was talking about the output of the function, not of the case structure. 🙂
0 Kudos
Message 1637 of 2,571
(10,309 Views)

(seen here)

 

To do some calculations on a 2D array, my first idea would probably not be to create an excel report from it, then use the report generation to apply some formulas to the excel file, followed by reading out the new data.

0 Kudos
Message 1638 of 2,571
(10,240 Views)

(seen here)

 

A flatt sequence, a while loop, 37 disconnected boolean indicators, 1369 boolean diagram constants,  1379 local variables, a stop button, and 37 identical delays!

 

Wow! Just wow! (Yes, this is just a small section of the code!)

 

 

Message 1639 of 2,571
(10,143 Views)

I always wonder.... didn't the person who created this ever think:  "There has to be a better way to do this!?"

 

 

0 Kudos
Message 1640 of 2,571
(10,131 Views)