LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

[Newbie] Generating a 2D array from two 1D arrays

Hopefully this question will be trivial to you experienced LabView users.

 

I would like to create a 2D array where the successive rows of this array are defined by the overlap of the inital 1D arrays. Lets call the two 1D array's: A and B and assume that they have the same size. The first row of the 2D array will have "A" for the first N elements, then the second array "B" will fill in the remaining elements for a total element length of 2N for the first row (the next N elements after 2N should be keyed in as 0, the reason for this is that I plan to overlap A until it is on the other side of B). The second row of the 2D array will begin to overlap the two arrays, essentially the first array will shift one to the right and the last element of the first array will overlap with the first element of the second array. The effective overall length of the second row is now 2N-1, the extra element can be filled up with a 0 in order to keep the array a (3N)x(3N) square. Basically what is going on is that every successive row of the 2D array is shifting the overlap between array "A" and array "B" until array "A" ends up on the other side of array "B".

 

 

If we let A+B=C visually what is going on is the following: 

 

AAAAAABBBBBB

  AAAAACBBBBB

    AAAACCBBBB

...

             CCCCCC

...

             BBBBBCAAAAA

             BBBBBBAAAAAA 

 

What I currently have is both 1D arrays indexed into 64bit doubles. I am not sure how to take these 64bit 1D arrays and produce the 2D array I want.

 

The end goal is to have a slider that picks out a particular row from the 2D array and plots the entire row essentially showing the overlap between the two 1D arrays. As you move the slider from left to right, you'll see a 'movie' of the two waveforms overlapping in time.

 

If anything is unclear, unreasonable or "much easier to do this way" please let me know. Thank you!

---
Where awareness goes, energy flows.
0 Kudos
Message 1 of 18
(3,862 Views)

Here is one way to do it:

 

OverlapArrays.png

 

Allows for different size arrays.

 

Message 2 of 18
(3,841 Views)

Here's another way....

 

 

0 Kudos
Message 3 of 18
(3,836 Views)

I will try this asap! THNX!!

---
Where awareness goes, energy flows.
0 Kudos
Message 4 of 18
(3,829 Views)

AB: Am I missing something, I do not believe there should be 3N rows in the result.  Assuming equal lengths it should be 2N+1.

0 Kudos
Message 5 of 18
(3,826 Views)

@Darin.K wrote:

AB: Am I missing something, I do not believe there should be 3N rows in the result.  Assuming equal lengths it should be 2N+1.


I was going by the "...(3N)x(3N) square..." in the original post, which does not agree with the graphics. Who knows what he really wants. 😄

0 Kudos
Message 6 of 18
(3,821 Views)

@altenbach wrote:

@Darin.K wrote:

AB: Am I missing something, I do not believe there should be 3N rows in the result.  Assuming equal lengths it should be 2N+1.


I was going by the "...(3N)x(3N) square..." in the original post, which does not agree with the graphics. Who knows what he really wants. 😄


Ah. There is a reason that I do not read posts very carefully....Smiley Very Happy

0 Kudos
Message 7 of 18
(3,817 Views)

My apologies I think that 3Nx3N was wrong

 

There would be 3N columns but 2N+1 rows

 

That makes more sense I think, sorry about the confusion. I implemented your diagram, but I'm having trouble with the slider part I was refering to. I think I'm gonna try and see if the array was properly made first.. but that requires writing it to a spreadsheet...and since I'm really new I'm having trouble with that as well haha.

 

 

---
Where awareness goes, energy flows.
0 Kudos
Message 8 of 18
(3,806 Views)

@VedranJ wrote:

I think I'm gonna try and see if the array was properly made first.. but that requires writing it to a spreadsheet...and since I'm really new I'm having trouble with that as well haha.



What's wrong with a plain array indicator, or even a graph? 😄

0 Kudos
Message 9 of 18
(3,791 Views)

Avert your eyes until you have tried this yourself:

 

Spoiler
OverlapArrays.png

 

Message 10 of 18
(3,788 Views)