How to loop through epochs on EEGLAB?

358 views Asked by At

I have epoched data in EEGLAB, however, the event codes are incorrect. I have a stimtrack channel which recorded the audio sent within the experiment so I am trying to rename my event codes according to which stimulus was sent within each trial.

I have epoched this channel on its own so that I can correlate each epoch with a stimulus array used in the experiment. I have used the following code to epoch the data using all the stimulus codes (1-3) although whilst the timing of these is correct, the codes are not

[OUTEEG, indexes] = pop_epoch(EEG);

How do I loop through all the epochs I have to then use the following code to identify correlations between the epochs and the audio stimuli.

all_coefs = [];
for j=1:141
    epoch = OUTEEG.epoch(j); #THIS IS THE LINE OF CODE I AM STUCK ON ESSENTIALLY.
    coefs = [];
    for i=1:20
        two_stim = twohz(i,:);
        a = corrcoef(epoch, two_stim); 
        coefs = [coefs; {a}];
    end
end

Thank you!

0

There are 0 answers