MATLAB: Mean of nested cell arrays

meannested cells

I have attached the 2 arrays which I am trying to calculate the mean, independently.
mycell.mat is a {10×1}{3×1}{7×1} cell. I need to calculate the mean of the 10 values within the nested cells.
So I need the: mean of mycell{1:10,1}{1,1}(1,1)
mean of mycell{1:10,1}{1,1}(2,1)
mean of mycell{1:10,1}{1,1}(3,1) and so on
mean of mycell{1:10,1}{2,1}(1,1)
mean of mycell{1:10,1}{2,1}(2,1)
mean of mycell{1:10,1}{2,1}(3,1) and so on
mean of mycell{1:10,1}{3,1}(1,1)
mean of mycell{1:10,1}{3,1}(2,1)
mean of mycell{1:10,1}{3,1}(3,1) and so on
Thank you

Best Answer

>> M = cell2mat(permute(cat(3,cv_perf{:}),[2,1,3]));
>> Z = mean(M,3)
Z =
0.058748 0.078402 0.095877
0.094780 0.133897 0.116949
0.144421 0.190915 0.140248
0.133917 0.158366 0.152102
0.143377 0.130409 0.130549
0.183644 0.180682 0.164413
0.084289 0.158605 0.090256