I agree this is a very well written script. However, I am somewhat confused about the Y input variable. In the comments above it says that 'Y' should be a column vector (I assume this means (:, 1)). My confusion comes from the following lines:
for i=1:a % F1
for j=1:b % F2
for k=1:n % Subjs
INDS{i,j,k} = ...
CELLS{i,j,k} = Y(INDS{i,j,k});
MEANS(i,j,k) = mean(CELLS{i,j,k});
end
end
end
The '...' was placed instead of the code to create the indices. The line CELLS{i,j,k} = Y(INDS{i,j,k}); generates a 3D cell from Y, which makes sense to have the data in three dimensions, however Y is a 1D column and creates a large number of NaNs.
Also, Matlab produces the following error:
??? Error using ==> horzcat
CAT arguments dimensions are not consistent.
Error in ==> rm_anova2 at 138
stats = {'Source','SS','df','MS','F','p';...
Long story short, what am I not getting about this?