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 14
(8,803 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'. 🙂

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! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
Message 2 of 14
(8,777 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.

Message 3 of 14
(8,771 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 14
(8,767 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 14
(8,760 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?

0 Kudos
Message 6 of 14
(8,755 Views)

The same question for me, I want to split eeg data into equal epochs. Like 1500 sample for each and I want to use this for preprocessing the data. If I have a data of 5000 I need to divide it into 1500 samples per set. Can u help me how to do this? 

0 Kudos
Message 7 of 14
(3,034 Views)

Just do a Reshape Array to a 4x1500

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 8 of 14
(3,022 Views)

@kiranteja93 wrote:

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


Perhaps the function Decimate 1D Array is what you are looking for.

paul_cardinale_1-1662746669329.png

 

 

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 9 of 14
(2,980 Views)

@Mahi8337 wrote:

 If I have a data of 5000 I need to divide it into 1500 samples per set. Can u help me how to do this? 


5000 is not divisible by 1500. Do you want to pad or truncate?

0 Kudos
Message 10 of 14
(2,968 Views)