Firstly, I am assuming that this is a repeated measures design, with one between-subject factor (group) and one within-subject factor (condition)? If not, there's little reason to use the flexible factorial over the full factorial. If so, your design matrix must also include subject as a factor. Your columns should be:
G1 G2 G3 C1 C2 C3 C4 C5 C6 G1C1 G1C2 G1C3 ... etc. ... S1 S2 S3 S4 S5 S6 ... etc.
This is essential for a repeated measures design. Another aspect to understand is that the most basic repeated-measures designs contain 2 error terms: the between-subject and the within-subject. Unfortunately, SPM isn't designed to work very easily with mixed-effects models at the group level. This means you have to specify multiple models in order to force the correct error term for your effects of interest.
For the main effect of group, you shouldn't be testing it in the full model because SPM will use the within-subject variance for the denominator of the test statistics. What you need to do is use imCalc to average over all 6 conditions for each subject. You will then have one image per subject, which you can put into a standard one-way ANOVA model to assess the main effect of group.
For the main effect of condition you can test this in the full model, but what you need to understand is that you are now working with an overparameterised design. In this situation, contrasts must adhere to being estimable functions of the model. You can read more about it here (https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4911391/) but the short version is that contrasts must be defined in terms of linear combinations of the rows of the design matrix, otherwise the contrast will be invalid. However, remember that being estimable doesn't protect you from getting the contrast wrong.
The contrast you have given appears to be testing for a linear effect of condition. Is this correct? You refer to it as a Main Effect, but in my mind this means comparing each condition to every other condition e.g. diff(eye(6)). If so, the approach you have taken seems fine, but you must make sure that you are averaging over all the interaction terms here. The paper you cite uses only two groups with a contrast of
[zeros(1,n1+n2) zeros(1,ng) MEc MEc*[n1/(n1+n2)] MEc*[n2/(n1+n2)]
where the first chunk of zeros refer to the subject effects, which Glascher & Gitelman put at the beginning of the design matrix. If you put subjects at the end, you just need to rearrange the order of this expression. For your design, you will need to adjust this to
[zeros(1,n1+n2+n3) zeros(1,ng) MEc MEc*[n1/(n1+n2+n3)] MEc*[n2/(n1+n2+n3)] MEc*[n3/(n1+n2+n3)]]
As for the interaction term, you will need a contrast with 2 rows to test whether the linear effect of condition differs between groups 1 and 2, AND whether the linear effect of condition differs between groups 2 and 3. As such, you will need
[zeros(1,n1+n2+n3) zeros(1,ng) zeros(1,nc) MEc - MEc zeros(1,nc);
zeros(1,n1+n2+n3) zeros(1,ng) zeros(1,nc) zeros(1,nc) MEc - MEc]
All that being said, the SPM flexible factorial approach is probably the most difficult way to run repeated-measures models. If you want to try some easier alternatives, have a look here: http://www.sciencedirect.com/science/article/pii/S1053811916001622
Hope that helps
Martyn McFarquhar, PhD
Lecturer in Neuroimaging
G30 Zochonis Building
The University of Manchester
+44 (0)161 306 0450