<pre><code>for i=1:length(subjects)
    EEG = pop_loadset([sub_name{i},'.set'],folder);
    for k = 1:length(EEG.event)-1
        disp(k);
        if strcmp(EEG.event(k).type,con1)
            k = k+1;
            if strcmp(EEG.event(k+1).type,con2)
                rt = EEG.event(k+1).latency-EEG.event(k).latency;
            end
        end
    end
end   
</code></pre>

CC BY-SA 4.0
2018-09-20T10:10:53.433Z
Welcome. What are the events? How are they defined and what are their characteristics? More general information helps too -  What was the experiment like? How many channels? What was the task, if any?
AliceD
CC BY-SA 4.0
2018-09-20T10:40:46.783Z
Thanks. There were two types of stimulus.stimulus1 followed by a response with no time limit. hence I have now data with 36 type1  stimulus,followed by their responses and same for type stimulus2. Total channels were 32. I am interested in retrieving the shortest reaction time between type1 stimulus and the response (same for type2 stimulus) and epoch the events based on this reaction time.
Bubbles
CC BY-SA 4.0
2018-09-20T10:48:48.897Z
And you know when these events happened? Or do you have to analyze the data to extract them?
AliceD
CC BY-SA 4.0
2018-09-20T10:55:41.567Z
No I don't know when these events happened. But for every event I have a trigger, based on them I need to extract event1 followed by its response and difference between their reaction time.
Bubbles
CC BY-SA 4.0
2018-09-20T14:43:29.787Z
This seems like more of a programming question, or a specific research question we can't really answer here: you need to decide what your response is before bothering to try to detect it.
Bryan Krause
CC BY-SA 4.0
2018-09-21T14:33:57.487Z
I agree with @BryanKrause - I am still uncertain what the bottle neck is in your analysis. As of now, according to the comment, it seems like a simple trigger time extraction problem, linking them to a time stamp and subtract the two?
AliceD
<eeg><reaction-time>
I want to find event1 in my EEG data, followed by event2 and then extract reaction time between them
Bubbles
# I want to find event1 in my EEG data, followed by event2 and then extract reaction time between them

(Asked by: username_0 on 2018-09-20)

for i=1:length(subjects)
    EEG = pop_loadset([sub_name{i},'.set'],folder);
    for k = 1:length(EEG.event)-1
        disp(k);
        if strcmp(EEG.event(k).type,con1)
            k = k+1;
            if strcmp(EEG.event(k+1).type,con2)
                rt = EEG.event(k+1).latency-EEG.event(k).latency;
            end
        end
    end
end

**Tags:** eeg, reaction-time

> **Comments:**
> **username_1**: Welcome. What are the events? How are they defined and what are their characteristics? More general information helps too -  What was the experiment like? How many channels? What was the task, if any?  
> **username_0**: Thanks. There were two types of stimulus.stimulus1 followed by a response with no time limit. hence I have now data with 36 type1  stimulus,followed by their responses and same for type stimulus2. Total channels were 32. I am interested in retrieving the shortest reaction time between type1 stimulus and the response (same for type2 stimulus) and epoch the events based on this reaction time.  
> **username_1**: And you know when these events happened? Or do you have to analyze the data to extract them?  
> **username_0**: No I don't know when these events happened. But for every event I have a trigger, based on them I need to extract event1 followed by its response and difference between their reaction time.  
> **username_2**: This seems like more of a programming question, or a specific research question we can't really answer here: you need to decide what your response is before bothering to try to detect it.  
> **username_1**: I agree with @BryanKrause - I am still uncertain what the bottle neck is in your analysis. As of now, according to the comment, it seems like a simple trigger time extraction problem, linking them to a time stamp and subtract the two?  

---

## 0 answers

