LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to Split an 1D array into number of sub arrays

hi all,

 i want to split an array into number of sub arrays at time. most of the time i am going through Split Array or Delete from array. but i am thinking that  by using these two functions i would make the vi a big mess. so please help me if anyone can ....

 Thank you

0 Kudos
Message 1 of 6
(2,301 Views)

Depending on what your goal is, Reshape to a 2D array might be the right tool. If you e.g. have a 100 element long array you can reshape it to a 10x10 and you'll have 10 'subarrays'. Smiley Happy

Else Array subset or as you mentioned Split in a loop is probably the right thing. If you e.g. want different lengths of the arrays you'll need to create an array of cluster having the 1D array parts as elements.

/Y

G# - Award winning reference based OOP for LV, for free! ADDQ VIPM Now on GitHub
"Only dead fish swim downstream" - "My life for Kudos!" - "Dumb people repeat old mistakes - smart ones create new ones."
Certified-LabVIEW-Developer
0 Kudos
Message 2 of 6
(2,275 Views)

kiranteja93 wrote:

 i want to split an array into number of sub arrays at time.


You don't provide sufficient information to really help you. How are you splitting? Is there some regularity on the split points? What are you going to do with the parts? How many parts do you have at the end? How big are the arrays?

 

Can you give an example or show us your code? Does it currently work correctly but you are worried about performance?

 

If you just want to operate on a subset, you can leave the input array in place and use "array subset" top get a part of it at a time. No need to chop up the input.


LabVIEW Champion Do more with less code and in less time
Message 3 of 6
(2,269 Views)

sorry for not providing the sufficient information. i want to divide an 1D  array into different arrays with same length. 

0 Kudos
Message 4 of 6
(2,265 Views)

@kiranteja93 wrote:

sorry for not providing the sufficient information. i want to divide an 1D  array into different arrays with same length. 


Then "Reshape Array" might be a good solution. And don't forget, there's also the function "Array Subset".

 

Regards, Jens

Kudos are welcome...
0 Kudos
Message 5 of 6
(2,258 Views)

@kiranteja93 wrote:

sorry for not providing the sufficient information. i want to divide an 1D  array into different arrays with same length. 


... and what do you want to do with the resulting parts?

 

What kind of problem you are trying to solve. Where does the input array come from? What should happen to the parts later? What should the final output be?


LabVIEW Champion Do more with less code and in less time
0 Kudos
Message 6 of 6
(2,253 Views)