取消
顯示結果 
搜尋替代 
您的意思是: 

Rube Goldberg Code

Simple task. Read a CSV file and get the two columns, dropping the header row (seen here)

 

altenbach_0-1617380547065.png

 

Apparently, we need to read the file twice with different delimiters and transpose setting to get a 2D array, one transposed and one not, one containing the first column and one containing both columns, delete the first row or column, transpose or not as needed, delete one column if there is more than one, then reshape to a 1D array to get each column. I am running out of breath!

 

Equivalent code:

 

altenbach_0-1617381166583.png

 

2261 條訊息(共 2,635 條)
10,592 檢視

@altenbach wrote:

Simple task. Read a CSV file and get the two columns, dropping the header row (seen here)

 

altenbach_0-1617380547065.png

 

Apparently, we need to read the file twice with different delimiters and transpose setting to get a 2D array, one transposed and one not, one containing the first column and one containing both columns, delete the first row or column, transpose or not as needed, delete one column if there is more than one, then reshape to a 1D array to get each column. I am running out of breath!

 

Equivalent code:

 

altenbach_0-1617381166583.png

 


Classic altenbach🙂

2262 條訊息(共 2,635 條)
10,488 檢視

Some simple array operations to create a table from a 1D array while skipping one element (seen here

 

 

 

altenbach_0-1618243818961.png

0 積分
2263 條訊息(共 2,635 條)
10,297 檢視

Seen here

 

Maybe not true Rube Goldberg Code, haven't examined it in detail, but the oval in the picture scares me. If that is their code, what does their container look like? 🙂

 

Snap99.png

 

mcduff

 

 

2264 條訊息(共 2,635 條)
10,269 檢視

@altenbach wrote:

I am scratching my head for an hour but I still have that nagging feeling that this code fragment could be simplified.

altenbach_0-1616806827461.png

 

(seen here)

 


Are you suggesting that any wire branch could rename wire y to wire x?  Seriously,  that is a simple RELABEL of the value.  A poor way to relabel the wires value but, other methods are not as demonstrative.

 

How else would YOU relabel a wire?

 

WHERE: y =x (as scope. ) LET....

 

I know , I think that you forgot that jarjon.


"Should be" isn't "Is" -Jay
0 積分
2265 條訊息(共 2,635 條)
10,100 檢視

@JÞB wrote: How else would YOU relabel a wire? 

... you are actually requesting rube code?... Is this now a rube competition?

 

relabel wire rube?relabel wire rube?

 

Wasn't there a rube sub-category called "WEC" (Wire equivalent code).

Troy - CLD "If a hammer is the only tool you have, everything starts to look like a nail." ~ Maslow/Kaplan - Law of the instrument
2266 條訊息(共 2,635 條)
10,098 檢視

Type cast

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 積分
2267 條訊息(共 2,635 條)
10,052 檢視

Except that wire labels are something else. Even if you have a formula node output and name it "y", then create an indicator on it, the indicator will be named "output variable", not "y". And if you show the wire label of that wire, it is initially blank.

 

According to my casual testing, a formula node cannot be used to change the name of a wire.

0 積分
2268 條訊息(共 2,635 條)
10,041 檢視

@altenbach wrote:

Except that wire labels are something else. Even if you have a formula node output and name it "y", then create an indicator on it, the indicator will be named "output variable", not "y".


The output label of a type cast is "*(type *) &x" when I tried it.

 

But why would you need this?

 

If the output is an indicator output of a VI, simply label the indicator how you want it.

If you want to use a unnamed bundler, but you want your elements labeled, wire a cluster constant.

If you want to use variant magic, well, this might actually be a decent way. Unless you start with a variant input.

 

I don't recall ever needing this.

2269 條訊息(共 2,635 條)
9,932 檢視

wiebe@CARYA wrote:
I don't recall ever needing this.

Yes, that was my point. We can label a wire manually for clarity, but otherwise the name is irrelevant.

 

(As mentioned much earlier, if we need to ensure that a data copy is made to work around a compiler issue, we have the "always copy" function. Any other kludge clouds the intent of the programmer and might even get optimized out by the compiler.) 😄

2270 條訊息(共 2,635 條)
9,907 檢視