LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Insert one array at the end of another....

Solved!
Go to solution

Hello, I've spent half a day to efficiently solve this simple problem, but unsuccessfully... Maybe you can point to the right direction..

 

I've for loop that generates two arrays .. Each usually contains couple of hundred elements.... I want to stick these arrays to gather in long 2D array as in attached figure.

 

 

 

 

0 Kudos
Message 1 of 12
(5,913 Views)

Just use Build Array.  You may need to use Transpose 2D Array to get the array the way you want it.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 12
(5,909 Views)
Solution
Accepted by topic author ku_ku

Like this? (assuming the two small arrays have the same lenght).

 

 

Message 3 of 12
(5,894 Views)

Why not just use Insert Into Array?

 

If you want things to be horizontal like you wrote, use the transpose array functions. If you don't mind using things rotated 90 deg, just leave them out.

 

 InsertArray.png

 

Cameron

 

To err is human, but to really foul it up requires a computer.
The optimist believes we are in the best of all possible worlds - the pessimist fears this is true.
Profanity is the one language all programmers know best.
An expert is someone who has made all the possible mistakes.

To learn something about LabVIEW at no extra cost, work the online LabVIEW tutorial(s):

LabVIEW Unit 1 - Getting Started</ a>
Learn to Use LabVIEW with MyDAQ</ a>
0 Kudos
Message 4 of 12
(5,865 Views)

@camerond wrote:

Why not just use Insert Into Array?


Did you even look at his image and read the description? He want to sequentially fill an initialize large array with new data. The input arrays are also 1D, not 2D.

 

In your example, it would also be more typical to use "build array (concatenate mode)" instead of "insert into array" (middle).

Even simpler, use a FOR loop and avoid all these transpositions (bottom):

 

 

 

Still, this code does NOT solve the original problem of this thread!!!

0 Kudos
Message 5 of 12
(5,848 Views)

Whoops. Yes I did, but I'll blame it on my glasses because I thought he had a 2-D array inside the FOR loop, as an example of what he was trying to combine. His initialization of a 2-D array at the front and an output array which had two copies of both input arrays (would have been adding a copy of the 2-D array inside, if it were there) seemed to support that conclusion, too.

 

Sorry, I'll be going back to the optometrist next week.

 

Cameron

 

To err is human, but to really foul it up requires a computer.
The optimist believes we are in the best of all possible worlds - the pessimist fears this is true.
Profanity is the one language all programmers know best.
An expert is someone who has made all the possible mistakes.

To learn something about LabVIEW at no extra cost, work the online LabVIEW tutorial(s):

LabVIEW Unit 1 - Getting Started</ a>
Learn to Use LabVIEW with MyDAQ</ a>
0 Kudos
Message 6 of 12
(5,822 Views)

Cameron,

 

Too many aromatic rings!

 

Lynn

0 Kudos
Message 7 of 12
(5,810 Views)

I'm just wondering, why my VI gives an error.. Is it because of version 8.6 or ?

 

If I remove the first index it work fine.

0 Kudos
Message 8 of 12
(5,766 Views)

You should only wire something to 1 of the index terminals (because you are putting an array into a 2D array) (had it been a single number into a 2D Array, you should have wired both index terminals)

If you wire to the first index terminal, it pops data into your 2D array row wise

if you use the second index terminal, it places it column wise

0 Kudos
Message 9 of 12
(5,748 Views)

Since you are preallocating your array, I think you want to use Replace Array Subset instead of Insert Into Array.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 10 of 12
(5,746 Views)