function[list_out] = getIndexFromSubjectName(e, list_in) list_out = []; for s = 1:length(list_in) found = 0; index =1; while ~found if ~isempty(strmatch(e.subjects(index).name, sprintf('Subject %d', list_in(s)), 'exact')) found = 1; list_out = [list_out index]; end index = index +1; if index > length(e.subjects) break; end end end