ET_PDToolkit/PDToolkit/@PDSession/setPatternMulti.m

48 lines
1.5 KiB
Matlab

function[obj] = setPatternMulti(obj, type, pattern)
%% define possible coding styles of markers
ton_codings = {'trial onset','trial on', 'start trial', 'trial start', 'trial_start'};
toff_codings = {'trial offset','trial off', 'end trial', 'trial end', 'trial_end'};
son_codings = {'stimulus onset','stimulus on', 'soa', 'stim on', 'stim_on'};
soff_codings = {'stimulus offset','stimulus off', 'stim off', 'stim_off'};
bon_codings = {'baseline on', 'baseline start', 'baseline onset', 'bl on', 'bl'};
boff_codings = {'baseline off', 'baseline end', 'baseline offset', 'bl off'};
if (ismember(lower(type), ton_codings))
ci = length(obj.trial_start_pattern) +1;
obj.trial_start_pattern(ci).pattern = pattern;
end
if (ismember(lower(type), toff_codings))
ci = length(obj.trial_end_pattern) +1;
obj.trial_end_pattern(ci).pattern = pattern;
end
%% stimulus onset
if (ismember(lower(type), son_codings))
ci = length(obj.stimulus_onset_pattern) +1;
obj.stimulus_onset_pattern(ci).pattern = pattern;
end
%% stimulus offset
if (ismember(lower(type), soff_codings))
ci = length(obj.stimulus_offset_pattern) +1;
obj.stimulus_offset_pattern(ci).pattern = pattern;
end
%% baseline onset
if (ismember(lower(type), bon_codings))
ci = length(obj.baseline_onset_pattern) +1;
obj.baseline_onset_pattern(ci).pattern = pattern;
end
%% baseline offset
if (ismember(lower(type), boff_codings))
ci = length(obj.baseline_offset_pattern) +1;
obj.baseline_offset_pattern(ci).pattern = pattern;
end