BreakPoint

cancel
Showing results for 
Search instead for 
Did you mean: 

Rube Goldberg Code

Well, its a LSMFP ("linear state machine with fixed personality" ) 🙂
Message Edited by altenbach on 04-08-2009 09:13 AM
Message 431 of 2,635
(12,210 Views)

How hard can it be to index out element(0,0) of a 2D array?

 

Easy(top): We simply reshape the 2D array to a 1D array with one element,  convert it to a cluster with 9 elements (?!), and unbundle the first element.

 

It seems more scenic than just use "index array" (bottom). 😄

 

 

(spotted here)

Message Edited by altenbach on 04-08-2009 09:52 AM
Message 432 of 2,635
(12,202 Views)

Just stumbled upon this cute way to build an array of strings... I really had to look twice Smiley Wink

Found here...

Message Edited by GerdW on 04-08-2009 09:42 PM
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 433 of 2,635
(12,188 Views)

Robert Cole wrote:

I know we don't like sequences, but...

 

If you're going to use a sequence, then use a sequence.

 

I think this structure was used to reduce the amount of space used (it could have been done in one line).

 

 Case Sequence

 

     Rob

Message Edited by Robert Cole on 04-08-2009 09:57 AM

That could looks like they really wanted the code I posted in my Nugget on control refs. Early version of me trying to make my config files less work to maintain looked something like that.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 434 of 2,635
(12,151 Views)

 

From two VIs in this post. Smiley Very Happy

 

I reduced it to:

 

Message Edited by Dennis Knutson on 04-09-2009 08:44 AM
Download All
Message 435 of 2,635
(12,132 Views)

Column selectionComplex way to extract columns from a 2D string array. 

 

Note that the1D I32 array is converted to a cluster only to be convert back to 1D I32s.

Message Edited by VADave on 04-09-2009 10:27 AM
Visualize the Solution

CLA

LabVIEW, LabVIEW FPGA
Message 436 of 2,635
(12,129 Views)

VADave wrote:

Note that the1D I32 array is converted to a cluster only to be convert back to 1D I32s.


This operation is actually more complex and not reversible. It's Rube Goldberg's way to reshape (pad, trim) the array to 16 elements in this particular case 😉 No matter what the input size is, the output will be size=16 (or whatever the array-to-cluster is configured). 😄

Message 437 of 2,635
(12,120 Views)
That was an unexpected "Feature" of the original code.
Visualize the Solution

CLA

LabVIEW, LabVIEW FPGA
0 Kudos
Message 438 of 2,635
(12,109 Views)

Wow! Dennis found an Express vi in the pallettes 🙂

 

-Ak2DM

~~~~~~~~~~~~~~~~~~~~~~~~~~
"It’s the questions that drive us.”
~~~~~~~~~~~~~~~~~~~~~~~~~~
Message 439 of 2,635
(12,077 Views)

AnalogKid2DigitalMan wrote:

Wow! Dennis found an Express vi in the pallettes 🙂

 

-Ak2DM


 

Go gentle on him Ak2DM since he's new in these parts. We don't want to scare him off into answering another 15K question or something even more dangerous. I suggest we try talking nice to him and maybe he won't go running off looking for a new question to squash.

 

Smiley Wink

 

Just having fun,

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 440 of 2,635
(12,073 Views)