Showing results for 
Search instead for 
Did you mean: 
Reply

Rube Goldberg Code

Re: Fun with array initializations



Ben wrote:
Now I have not checked recently but in LV 5 or there-abouts, the top input of the math operators was re-used...
I've never seen any difference (speed, memory, buffer allocation, etc.) if you swap the inputs to the multiplication. I think they are equivalent in recent LaVIEW versions.
Message 61 of 1,734 (10,010 Views)

Unnecessary Operations

In here there are several unnecessary operations.
 
1.  Let's take a number and subtract zero.
2.  Let's feed the size of the array into the for loop and also autoindex it.
3.  Let's step through an array of clusters, then unbundle and rebundle each one.
Message 62 of 1,734 (9,959 Views)

Re: Unnecessary Operations

[ Edited ]
I get a chuckle out of this one. I guess it means that To Lower is not commutative.

Message Edited by Odd_Modem on 06-15-2007 05:38 AM

0 Kudos
Message 63 of 1,734 (9,883 Views)
Reply
0 Kudos
Highlighted

Re: Rube Goldberg Code

[ Edited ]
I'm not sure I see what is "Rube Goldberg"-ish about this ("fun with caps" example). It seems more like an experiment to see what the behavior of those functions is with respect to numbers. The experiment makes sense when you see the actual behavior of the functions.

Message Edited by smercurio_fc on 06-15-2007 09:25 AM

0 Kudos
Message 64 of 1,734 (9,876 Views)
Reply
0 Kudos

Re: Rube Goldberg Code

It just means that "to upper" and "to lower" both loose information. The "rube-ish" part is the fact that the loop runs for 1023 iterations (why not 1024), while we only have 256 characters. Smiley Happy

Plot "toUpper-ToLower" vs "ToLower-ToUpper" for some real mess. Smiley Wink

0 Kudos
Message 65 of 1,734 (9,858 Views)
Reply
0 Kudos

Re: Rube Goldberg Code

Yeah, I know. It just doesn't seem very "Rube Goldberg"-ish to me. At least based on the definition you had provided from Wikipedia, and prior examples. A curiosity nonetheless.
0 Kudos
Message 66 of 1,734 (9,852 Views)
Reply
0 Kudos

Re: Rube Goldberg Code

[ Edited ]
Some easy path operations, the Goldberg way. Smiley Very Happy
 
As a substitute for a simple file dialog, we can use...
  1. "open file"
  2. convert the refnum to a file name
  3. then close the file.
  4. Why!!!!!!
As a substitute for strip path, we could ...
  1. convert the path to a string
  2. reverse the string
  3. search for "\" (will only work on windows Smiley Sad)
  4. get the remaining string
  5. Reverse the remaining string
  6. convert the string back to a path.
  7. Why!!!!!!!

Here are some literal simplifications:

(Of course we could configure the file dialog to select a folder, so we don't even have to strip anything! Smiley Happy)

(adapted from http://forums.ni.com/ni/board/message?board.id=170&message.id=263204. The actual VI had the code all over the place and not nicely aligned as shown here).

Message Edited by altenbach on 08-03-2007 12:09 AM

Message 67 of 1,734 (9,625 Views)

Ways to read a two-column table from a file

[ Edited ]

(Adapted from http://forums.ni.com/ni/board/message?board.id=170&message.id=264879&jump=true)

We need to read a simple two-column file (tabs between elements, linefeeds between rows) and place the first column into an x-array and the second column into a y array.

Lets do the following: We have a file path control that needs to be connected via a right-left wire to read the raw text. Now we first need to parse it into an interleaved array, throwing away the distinction between tab and newline. Of course we need to read 2048 points, no matter how many points are in the file. Since we now have an interleaved array, we need to decimate it again into the two colums. (A simple decimate array node with two terminals would be way too simple, we better use two FOR loops and index out the even and odd elements.

or we could just do the following:

Message Edited by altenbach on 08-11-2007 12:43 PM

Message 68 of 1,734 (9,547 Views)

Sequence-itis

[ Edited ]
 
If somebody would try to argue that stacked sequences are not that great, here are "supporting documents" (see comments on image). Smiley Happy
 
 
Or we could add a lot of functionality (plotting of the best fit, etc.) and still have a much simpler diagram:
 

Message Edited by altenbach on 08-11-2007 01:08 PM

Message 69 of 1,734 (9,550 Views)

Re: Sequence-itis

These are great. You should just start Alten's weekly fixes or something like that. Smiley Very Happy

___________________
Try to take over the world!
Message 70 of 1,734 (9,536 Views)