@JohnZwinck, l can't make them into a single multidimensional array because each my_data[i] is a data example which is different from my_data[j] where i !=j. So the process l defined for computing the means of two successive arrays concern each my_data[i] , but can't for example compute the mean of the last array of my_data[i] and the first array of my_data[i+1]. Hope it's clear.