I am using a MatLab based interface for processing EEG files collected from 59 subjects. The below code works but only for 1 file and I have 59 files I want a result from. sFiles filters the files stored in this interface and correctly returns 59 files. However, sStudy only returns a result for the first file. How do I run a loop on the below code so I can get 'n' for all 59 files? I would like to get the result 'n' for each file along with the subject name (in sFiles as SubjectName).
sFiles = bst_process('CallProcess', 'process_select_search', , , ...
'search', '(([name CONTAINS "resample"]))');
sStudy = bst_get('Study', sFiles.iStudy);
DataMat = in_bst_data(sStudy.Data(i).FileName);
n = numel(DataMat.F.events(3).times)