Epoch EEG data using a script

The problem is the type of the data in "datafile" indeed. It is expected to be a list of file (cell array), not a single file name as you did (char). Use "RawFiles(i)" instead of "RawFiles{i}" and it should work.

You could also maybe replace all the creation of your RawFiles variable with a short loop:

RawFiles = cell(1,36);
for i = 1:36
    RawFiles{i} = sprintf('F:\Dissertation\Clean_v4\%s_Cleaned_v4.set',SubjectNames{i});
end