LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

push into 2D array

I'm wondering how to push data into array as follows:

 

Given 2D array:

column x: 1 3 5 7 ...

column y: 2 4 6 8 ...

 

Then go through for-loop:

Iteration 1:

column x: 1

column y: 2

 

Iteration 2:

column x: 3 1

column y: 4 2

 

etc. I included the VI where I want to implement this. I tried my hand at reversing arrays, but that didn't work as intended.

I added a size limit, because my intent is to delete the last index row after it's 'pushed' over the limit.

 

Cheers.

 

0 Kudos
Message 1 of 5
(2,072 Views)

Whatever you are describing has no resemblance to the code you have attached. Can you fill the controls with reasonable default values before attaching? Also tell is what the final output should be. Do you need the intermediary results or just a new 2D array with the columns reversed?

0 Kudos
Message 2 of 5
(2,047 Views)

Output should be like:

 

9 10

7 8

5 6

3 4

1 2

 

Where  1 2 is added first, 3 4 added second, etc... I'm not very used to LabVIEW yet, so my excuses if it's confusing.

I want to implement something like this in Java ( push( ) ), so pushing something on top of the 'stack', and removing the bottom element if size > 10.

I don't need intermediary results. The result should be a trail of sorts over the field.

 

0 Kudos
Message 3 of 5
(2,038 Views)

@marvin117 wrote:

Output should be like:

 

9 10

7 8

5 6

3 4

1 2

 

Where  1 2 is added first, 3 4 added second, etc... I'm not very used to LabVIEW yet, so my excuses if it's confusing.

I want to implement something like this in Java ( push( ) ), so pushing something on top of the 'stack', and removing the bottom element if size > 10.

I don't need intermediary results. The result should be a trail of sorts over the field.

 


Why does it matter in which order the things are added if only the final result matters?

0 Kudos
Message 4 of 5
(2,031 Views)

Well, earlier you had columns, now you have rows. Please be more consistent!

 

Anyway, here's one possible solution for the original problem:

 

 

 

(Just transpose if you want columns instead)

0 Kudos
Message 5 of 5
(2,025 Views)