11-10-2017 12:48 AM
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
11-10-2017 02:17 AM - edited 11-10-2017 02:19 AM
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
11-10-2017 03:19 AM
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.
11-10-2017 03:22 AM - edited 11-10-2017 03:25 AM
sorry for not providing the sufficient information. i want to divide an 1D array into different arrays with same length.
11-10-2017 03:44 AM
@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
11-10-2017 03:51 AM
@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?
09-08-2022 05:02 AM
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?
09-08-2022 06:57 AM
Just do a Reshape Array to a 4x1500
09-09-2022 01:04 PM
@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.
09-09-2022 07:03 PM
@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?