%% subject loop
function decode = calculateMultiSubjectDecodePerformance(header,subjectdata,svmopts)

decode = struct;
decode.decodePerformance = [];
decode.rawTimeCourse     = [];

nSubjects = numel(subjectdata);

disp(sprintf('batch processing %g subjects',nSubjects));

for subjectDataID = 1:nSubjects
%     SubjectID = cell2mat(subjectCell);
    currentSubject = subjectdata{subjectDataID};

    namehelper = strcat('s',currentSubject.name); %Vars can not start with numbers.

    display(sprintf('calculating cross-validation performance time-shift for Subject %s. Please Wait. ...',currentSubject.name));
%     display('switching off all warnings');
%     warning_state               = warning('off','all');
    display('calculating ...');
    
        decode.(namehelper)         = calculateDecodePerformance(header,currentSubject,svmopts);

    display('... done');
%     display('restoring warnings');
%     warning(warning_state);

    decode.decodePerformance    = [decode.decodePerformance decode.(namehelper).decodePerformance];
    decode.rawTimeCourse        = [decode.rawTimeCourse decode.(namehelper).rawTimeCourse];

    assignin('base','decode',decode);
end

end