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

you forgot simply using an inverter.......

 

...... NOT!

Message 51 of 2,571
(25,845 Views)
Hmmmm....
 
So if the value is zero, we need a one and if the value is nonzero, we need to add one to the value. This is complicated.
What would happen if we just blindly add one in all cases??? 😮
 

Message Edited by altenbach on 05-11-2007 09:05 AM

Message 52 of 2,571
(25,785 Views)
Lol, well, I just discovered this thread, and I remembered a recent posting in which I drawed some Rube Goldberg Code, so I came to share it with you, but seems altenbach did it first Smiley Very Happy  (The code in the Plus One? entry is mine). Well it's a bit embarrasing to find it out, but...what can I say? I posted it...Smiley Sad

To my defense, I was sleepy and had no cofee near.

P.S. This thread is really fun, I'm having a great time here...shame I'm a contributor.



Message Edited by Robst on 05-15-2007 05:09 PM



Robst - CLD

Using LabVIEW since version 7.0


Message 53 of 2,571
(25,742 Views)


@Robst wrote:
...shame I'm a contributor.

No, you should be proud! Welcome to the club!

Any LabVIEW programmer who claims he has never made any RG code is a liar! 🙂

Besides for the comic effect, this thread actually is a great learning tool for many. Don't underestimate its power.

Message Edited by altenbach on 05-15-2007 04:45 PM

Message 54 of 2,571
(25,732 Views)
Hey, thanks for the welcome altenbach!, now I feel much better Smiley Very Happy

And yes, I agree with you, this thread can be a great learning tool for many. Some common mistakes are shown here, so others can learn a better way to get the same results....actually I've learned some things.

Regards!





Robst - CLD

Using LabVIEW since version 7.0


Message 55 of 2,571
(25,709 Views)
Say we need to process an array of clusters and format it into a table where each cluster forms one line and then write it to a text file.
 
We could do it with three frames of a stacked sequence, using a While loop where we need to keep track of the array indexing, array size, unbundling, parsing all parts individually, and concatenating all fragments to the previous line by bouncing it trough a local variable of and indicator that we really wouldn't even need otherwise....
Notice that we measure the array size at every iteration of the loop. Since we read the local at every iteration we are not sure if other parts of the program will change it 😮
 
 
 
 
Or we could just use a small autoindexing FOR loop to do basically the same. 🙂
 
 
 
Do whatever is more conveninent! 😄
 
(Of course there are quite a few othere ways to do this.)
 

Message Edited by altenbach on 05-24-2007 08:30 AM

Download All
Message 56 of 2,571
(25,645 Views)
We have an existing 2D array and need to initiaize an array with the same size, containing all zeroes.
 
We can do it the hard way or the easy way.
 

 
The easy way also has additional advantages, for example LabVIEW can potentially re-use the existing buffer and do things in-place..
 
 
 
 

Message Edited by altenbach on 05-28-2007 11:01 AM

Message 57 of 2,571
(25,610 Views)

...but what if you wanted to re-use the buffer in another part of the code? Since the array size can be scheduled to run before the other code, it only has to look a the buffer before it is uesd elsewhere.

Now I have not checked recently but in LV 5 or there-abouts, the top input of the math operators was re-used...

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 58 of 2,571
(25,585 Views)

Ben,

Would you not simply bring a wire to the other part of the code? or better yet, use a Functional Global Variable to avoid messy wires on the block diagram?

RayR

Message 59 of 2,571
(25,581 Views)

For those that have not seen the discussion see this thread on LAVA were Rolf and I agreed there was something wrong with memory allocation.

And yes Ray, an Action Engine is the easiet way (that I know of) to manage my memory usage.

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 60 of 2,571
(25,571 Views)