Thank you Thomas. Of course, I figured out that teg_repeated_measure_ANOVA.m was the one to use, and got it working - and then forgot to look back here!
I logged in again because I am trying to verify my output (and understand it) by comparing with SPSS linear mixed models (which I believe should deal with missing values). At the moment, the two outputs do not match up. Do you know if there is a difference in how they deal with missing values? Can you think of any other reasons why the two should be giving slightly different results? It is, of course, possible that I've done something wrong in SPSS.
This looks like exactly what I need. But I am having some problems getting it to run. Not wanting to reinvent the wheel, I'm hoping someone can help:
1. _bu3 is the version I should be using?
2. there is an 'end' missing somewhere. I've tried putting it in a couple of places that potentially make sense (without understanding all of the code)
3. but I'm getting an error:
??? Attempted to access O(:,4); index out of bounds because size(O)=[0,0].
Error in ==> teg_repeated_measures_ANOVA_bu3 at 136
pvec = O(:, 4);
Many thanks for any help.
(I agree with the previous comments: More commenting in the code/ a coded example would make all the difference.)