How can I split an array into equal overlapping sub-arrays?
Mostra commenti meno recenti
How can I split an array into equal overlapping sub-arrays?
Simple example where the array divides evenly without any need for overlapping
ArrayX = 1:160;
ArraySplitSize = 4
Result is
1:40, 40:80, 80:120, 120:160
Example where overlapping is needed. I want to keep full size of the array and not cut off anything at the end.
ArrayX = 1:100;
Subarray = 40;
ArraySplitSize = 3;
Result is 1:40, 30:70, 60:100
3 Commenti
Image Analyst
il 10 Apr 2020
Kelly Kearney
il 10 Apr 2020
Also, what's the rule you used to decide which of the overlapping blocks get shorted when the array isn't evenly divisible? E.g. in your latter example, you indicate subarrays of length 40, 41, and 41. Also, in your first example, you listed values with overlaps; I assume that should be 1:40, 41:80, 81:120, and 121:160, right?
mark palmer
il 10 Apr 2020
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Special Functions in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!