[Eeglablist] [eeglab] Question about extracting epochs
Scott Makeig
smakeig at ucsd.edu
Tue Apr 6 11:00:22 PDT 2004
Mike -
The following script will do it, I think. -Scott Makeig
function [sorttimes,sortidx] = eeg_sortepochs(EEG)
if ~isstruct(EEG)
error('eeg_sortepochs(): input must be an EEG dataset structure');
end
times = zeros(EEG.trials,1);
for k=1:EEG.trials
j = find(cell2mat(EEG.epoch(k).eventlatency) == 0);
times(k) = EEG.epoch(k).eventinit_time{j};
end
[sorttimes,sortidx] = sort(times);
return
~
~
Mike Cohen wrote:
> Hi. When extracting epochs from continuous data, the epochs are sorted
> in numerical order according to the event number (i.e., all the 1s
> first, then all the 2s, then all the 3s, etc.). However, I'd like to
> have them sorted them chronologically instead. Is there a way to keep
> the chronological order when epoching different event types? Or is
> there a way to re-sort extracted epochs according to when during the
> experiment those events occured?
>
> Thanks in advance,
>
> Mike Cohen, FAA-certified pilot
> UC Davis Psychology
> http://dynamicmemorylab.org/mcohen
>
More information about the Eeglablist
mailing list