Hi
I am new user for GLM_flex as well as Matlab. looking at the example onthe google groups. I have tried to write the script for my 2 within subject factor design.
Briefly I have age group and song type as two within subjectfactors.
I have one group of 16 birds which were scanned at different age during their development. At every scan day, they were played two types of songs. making song as secondwithin subject factor.
 I used SPM for 1st level analysis and generated two t-contrast images per subject at every age. for example Bird1 imaged at 55day - song played- TUT1 and TUT2. The two contrast images are- TUT1-Rest,TUT2-Rest.Same bird is then scanned at day 90 and two t-contrast images are generated.
Now I am trying to use GLM_FlexFast4 for analysing 2nd level anova for main effect of age , main effect of song played and interaction between two factors.
Following is the script I wrote looking at other examples.
I am stuck at defining which files are for which factor in data structure .Please can someone help me.
Scans={
             'G02_55_TUT1.nii';
             'G02_55_TUT2.nii';
             'G02_90_TUT1.nii';
             'G02_90_TUT2.nii'} just for illuastrative purpose how scans are named for each subject
Scans = dir_wfp('/home/gobeslab/maledataset/2nd level/GLM_flex/2x2within/*.nii');
delete *.mat *.nii
clear dat
dat.fn = [];
dat.Group=[];
dat.Factor1 = []; % 2 levels
dat.Factor2 = []; % 2 levels
dat.SS = []; % subject
for ii = 1:numel(Scans)
   [a b c] = fileparts (lower(Scans{11}));
   tmp = regexp(b, '_','split');
  Â
   dat.fn{ii} = Scans{ii};
   dat.SS {ii,1} = tmp{1} ;
   dat.Factor1 {ii,1} = tmp{2};
   dat.Factor2 {ii,1} = tmp{3};
end
dat.Group = cell(64,1);
dat.Factor1 =
clear I;
I.Scans = dat.fn ;
I.Model = 'Factor1 * Factor2 + random(SS|Factor1*Factor2)';
I.Data = dat;
I.outputDir = ['/home/gobeslab/maledataset/2nd level/GLM_flex/2x2within'] ;
I.RemoveOutliers = 0;
I.DoOnlyAll = 1;
I.estSmooth = 1;
I = GLM_Flex_Fast4(I)
thank you
Payal