From: Daniel on
I realize this thread is years old, nevertheless...

To use anovan for repeated measures, you have to enter the subject id's as a new factor and specify that factor as a random variable in anovan. If you have different subjects in different groups, you must also specify that the subject index is nested in the group variable.

In the example above, if the first cell is the between conditions factor and the remaining two cells are within subjects factors then the correct way to specify the factor indexes is as follows (with a bit of rearranging for clarity):

subjects = [1 2 3 4 5 6 7 8]; % Assuming that subjects 1-4 were in group 1 and 5-8 were in group 2

group = {[1 1 1 1 2 2 2 2];
['hi';'lo';'hi';'lo';'hi';'lo';'hi';'lo']; {'may' 'may' 'june' 'june' 'may' 'may'
'june' 'june'}; subjects}

Then call anovan:

anovan(data, group, 'random', 4, 'nested', [0 0 0 0; 0 0 0 0; 0 0 0 0; 1 0 0 0]);

This will produce the appropriate ANOVA output.

Dan