%% Pick your species/subjects

hemi    = 'R';


dname   = '/vols/Data/rbmars/Chimps/surface_fdt_matrix2';

subjects = {'Agatha','Amanda','Barbara','Bo','Brodie','Callie','Cheeta','Christa','Cissie','Fiona','Foxy','Frannie','Jacqueline','Jaimie','Jewelle','Leslie','LilOne','Liza','Lulu','Marietta','Rebecca','Rowena','Sabrina','Suwanee','Sylvia','Wenka'};

% read in results
avgmat=0;
for s=1:length(subjects)
    subj=num2str(s);
    disp(['-------' subj '--------'])

    fname=[dname '/' subjects{s} '/surfseed_' hemi '_15mm_take4b/fdt_matrix2.dot' ];
    mat=spconvert(load(fname));

    avgmat = avgmat+mat;
end
avgmat=avgmat/length(subjects);
%
save([dname '/AVG_Matrix2_' hemi '_15mm_take4b_allsubjects.mat'],'avgmat','-v7.3');

%%

clear;

hemi    = 'L';


dname   = '/vols/Data/rbmars/Chimps/surface_fdt_matrix2';

subjects = {'Agatha','Amanda','Barbara','Bo','Brodie','Callie','Cheeta','Christa','Cissie','Fiona','Foxy','Frannie','Jacqueline','Jaimie','Jewelle','Leslie','LilOne','Liza','Lulu','Marietta','Rebecca','Rowena','Sabrina','Suwanee','Sylvia','Wenka'};

% read in results
avgmat=0;
for s=1:length(subjects)
    subj=num2str(s);
    disp(['-------' subj '--------'])

    fname=[dname '/' subjects{s} '/surfseed_' hemi '_15mm_take4b/fdt_matrix2.dot' ];
    mat=spconvert(load(fname));

    avgmat = avgmat+mat;
end
avgmat=avgmat/length(subjects);
%
save([dname '/AVG_Matrix2_' hemi '_15mm_take4b_allsubjects.mat'],'avgmat','-v7.3');
