function [StimulusVariable] = recode_var(triggers, cond) % this function recodes the trigger variable into a dichotomous variable % in which the values in the cond vector are coded as '1's and all other % values coded as '0's. eq = zeros(length(triggers(:,1)),length(cond(:,1))); StimulusVariable = zeros(length(triggers(:,1)),1); for i = 1:length(triggers(:,1)) for k = 1:length(cond(:,1)) if triggers(i,1) == cond(k,1) eq(i,k) = eq(i,k) + 1; end end end for i = 1:length(triggers(:,1)) if any(eq(i,:)) == 1 StimulusVariable(i,1) = StimulusVariable(i,1) + 1; end end