function subjectData = runCoordTable(args)

% global SVMCROSSVAL_SUBJECTSTRUCT_NAME;

    disp('run coord table')
    
    subjects = args.subjects;
    nSubjects = numel(subjects);
    sessionlist = args.sessionList;
    pstopts = args.psthOpts;
    
    disp(sprintf('batch processing %g subjects.',nSubjects));

    for s = 1:nSubjects
        subjectStruct{s}.dir = fullfile(args.basedir,cell2mat(subjects(s)));
        d = load(fullfile(subjectStruct{s}.dir,'results','SPM.mat'));
        subjectStruct{s}.des = d.SPM;
        subjectStruct{s}.name = cell2mat(subjects(s));
        
        map = load(fullfile(subjectStruct{s}.dir,'results','roi','coord_map.mat'));
        subjectStruct{s}.coords = getSubjectCoordinates(args.coords,map);
        
%         nVoxel = size(subjectStruct{s}.coords,1);
        
        disp('fetching volume definitions, please wait');
        subjectStruct{s}.volumes = spm_vol(getImageFileList(subjectStruct{s}.dir,sessionlist,args.mask));
      
        [extr nExtractedVoxel] = calculateImageData(subjectStruct{s}.volumes,subjectStruct{s}.coords);
         
        pstopts.des = subjectStruct{s}.des;
        pstopts.eventList = args.eventList;
        pstopts.sessionList = sessionlist;
        
        disp(sprintf('computing psth for %g voxel',nExtractedVoxel));
        for iVoxel = 1:nExtractedVoxel
            rawdata = [];
            for iImage = 1:length(extr);
                tmp = extr(iImage);
                rawdata = [rawdata tmp.dat(iVoxel)];
            end
            subjectStruct{s}.rawData{iVoxel} = rawdata;
            subjectStruct{s}.pst{iVoxel} = calculatePST(args.timeline,pstopts,rawdata);
        end
        
       disp(sprintf('done %g / %g',s,nSubjects));
    end
    
    subjectData = subjectStruct;
%     assignin('base',SVMCROSSVAL_SUBJECTSTRUCT_NAME,subjectStruct);
end