LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Splitting and Concatenating a 1-D Array

Hello,

 

I have a 1-D array of numbers and I am trying to split the 1-D array and then contanenate into a new 1-D array. 

 

I am taking three sets of data from the original 1-D array and then forming the new concatenated array with what should be a space in between.

 

What I am finding is that the final concatenated 1-D array is empty.

 

Also I think I am using the incorrect spacer between the three data sets. I'm usinga 1-D array of noughts and really what I what I want is to create 1 column of noughts.

 

The .vi is attached.

 

Thanks for helping.

 

 

0 Kudos
Message 1 of 11
(2,610 Views)

You are not concatenating the arrays, you are interleaving them.

 

Concatenating means you put array 1, followed by array 2, followed by array 3, .... in order.

 

Interleaving is when you go Array 1 element, 1,  array 2 element 1, array 3 element 1, then array 1 element 2, array 2 element 2.

 

Since you have an empty array as a constant, you can't interleave anything with it since nothing is in that array.

 

I don't know what you mean by a "1-D array of noughts" and "1 column of noughts".

0 Kudos
Message 2 of 11
(2,607 Views)

OK, I see. 

 

Yes, Interleaving is definitely not concatenating. 

 

What I want to do is put back together the 3 data sets (which have been extracted from the original 1-D array) into a new 1-D array separeted by 1 zero. Its effectively a reverse split.

 

I will eventually save to a spreadsheet file and this will be done successively so the zero will become a column in the spreadsheet. 

 

That's what I meant by column.

 

 

0 Kudos
Message 3 of 11
(2,598 Views)

Just trying to figure out how I can build 1-D array from three separate 1-D arrays.

 

I can't use build array becasue this builds an 3 -dimension array from the 3 x 1-d arrays.

 

0 Kudos
Message 4 of 11
(2,584 Views)

@nevica wrote:

Just trying to figure out how I can build 1-D array from three separate 1-D arrays.

 

I can't use build array becasue this builds an 3 -dimension array from the 3 x 1-d arrays.

 


Yes, you can (And its the right function to use) Right-click the Build array select "Concatinate inputs"

 

Hit ctrl+h.  This will bring up a help pane for any function you are hovering over.  THEN READ the details by clicking the "Delails" link in the help window.  You can learn an aweful lot by doing thatSmiley Wink


"Should be" isn't "Is" -Jay
0 Kudos
Message 5 of 11
(2,571 Views)
You can certainly use a build array but to use the write to spreadsheet file, you should be creating a 2D array. It sounds overly complicated to insert a valuelike your description. Probably sure to end up on the Rube Goldberg thread.
0 Kudos
Message 6 of 11
(2,568 Views)

<beaten to it>

0 Kudos
Message 7 of 11
(2,562 Views)

Thanks, your right. It can concatanate inputs. And yes, I should read the descriptions!!!

 

So what I have now is the three data sets concatanated but there is no space between them.

 

I have tried to make a zero data point as you can see from the .vi but non appears beacause it is an empty number.

 

I've tried to pull a zero onto the constant but it reverts back to shaded meaning it cannot be entered. Is there a way around this?

 

 

Addendum. Thinking is too complicated. I just used a zero numeric constant and that has solved it!!!

0 Kudos
Message 8 of 11
(2,557 Views)

Well yes an empty array is empty and has no length.

Try this: Excel shoud interperate the NaN as 0 but any graph you show the concatinated array on will look a lot nicer.

!1.png


"Should be" isn't "Is" -Jay
0 Kudos
Message 9 of 11
(2,549 Views)

Solution attached!

 

Capture.JPG

0 Kudos
Message 10 of 11
(2,536 Views)