The 6 faces method is a very cheap and fast way to calibrate and accelerometer like my MPU6050, here a great description of the method.
I made 6 tests to calibrate the accelerometer based on the g vector.
After that I build up a matrix and in each row is stored the mean of each axis expressed in m/s^2, thanks to this question I automatically calculated the mean for each column in each file.
The tests were randomly performed, I tested all the six positions, but I didn't follow any path. So I sorted manually the final matrix, based on the sort of the Y matrix, my reference matrix. The Y elements are fixed.
The matrix manually sorted is the following
Here how I manually sorted the matrix
meanmatrix=[ax ay az];
mean1=meanmatrix(1,:);
mean2=meanmatrix(2,:);
mean3=meanmatrix(3,:);
mean4=meanmatrix(4,:);
mean5=meanmatrix(5,:);
mean6=meanmatrix(6,:);
meanmatrix= [mean1; mean3; mean2; mean4;mean6;mean5];
Based on the Y matrix constrain how can sort my matrix without knowing "a priori" which is the test stored in the row?