BreakPoint

cancel
Showing results for 
Search instead for 
Did you mean: 

Rube Goldberg Code

I had edited my post but you got to it first Smiley Very Happy: I should add, I guess I could have a constant array and index it 

 

 


@altenbach wrote:

@for(imstuck) wrote:

On FPGA you could make a case structure with a constant in 17 cases, or you could use scale by a power of 2. Good thing it wasn't a 64 bit number....

 

I'm curious if there's another way to get a 0 as the first element without using the select (and without a build array after the loop). Any takers?

 


What's the point of your code? Since all inputs are constant, you might as well create a lookup table and use no code at all. (most likely that's what the compiler does anyway ;))




0 Kudos
Message 1281 of 2,600
(11,544 Views)

Whats the point of the select anyway? 2^-1 =0.5 rounded away from odd to fit an integer type and...

!1.pngSmiley Very Happy

 

Fits on a postage stamp


"Should be" isn't "Is" -Jay
Message 1282 of 2,600
(11,532 Views)

found this one here...look into the "cv.vi" file of the llb

save.png

0 Kudos
Message 1283 of 2,600
(11,517 Views)

Here is code where the programmer is having problems about the "colors" being wrong for the plots when trying to change the visibility.  Actually the labels are wrong because they are rebuilding the array.

 

 

Cluster to Array instead of Build Array.  The 13 case case structure to rebuild an array for 0 to 12 items selected.  The Index Arrays inside of that have all of their constants wired.  Overall unnecessary array manipulation.  This could all be cleaned up to this.  But it still doesn't solve the problem.

 

But knowing what the programmer really wants, all they need to do is set the visibility property of each plot.  And you get this.  Problem Solved.

Download All
Message 1284 of 2,600
(11,403 Views)

@RavensFan wrote:

 

But knowing what the programmer really wants, all they need to do is set the visibility property of each plot.  And you get this.  Problem Solved.


Is LV 2012 (or was it introduced in 2011?) being used? If so, it could be done with no code and just enabling the visibility checkboxes that are built in.

0 Kudos
Message 1285 of 2,600
(11,385 Views)

His VI was saved in LV 2011.  I don't remember which version of LV introduced the checkboxes in the legend.  The visibility property node may not have even existed for individual plots until the checkboxes were introduced.  I don't know.

 

If the built-in checkboxes exist and they are okay for the programmer, then there is no need for even that final amount of code.  But I went on the assumption that they still wanted a separate means of programmatically changing the visibility.

0 Kudos
Message 1286 of 2,600
(11,370 Views)

(seen here)

 

A case structure with two cases, packed with the same local variables and the same code (except for the presence/absence of a +1 in one place. All terminals just sitting there disconnected. (top left in picture)

 

 

A literal translation is shown at the bottom right. 

 

(of course once we figure out what this code is supposed to do, a one-liner the size of a postage stamp might be sufficient :D)

0 Kudos
Message 1287 of 2,600
(11,262 Views)

@JÞB wrote:

Whats the point of the select anyway? 2^-1 =0.5 rounded away from odd to fit an integer type and...

!1.pngSmiley Very Happy

 

Fits on a postage stamp


I like bit twiddling when possible, reminds of assembler and stuff where i started, so:

2Exp.png

/Y

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

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 1288 of 2,600
(11,179 Views)

Hi Y,

 

like that?

check.png

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 1289 of 2,600
(11,171 Views)

Nice tweak to mine, haven't thought about Logical shift being able to take arrays. 😄

/Y

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

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 1290 of 2,600
(11,153 Views)