<div dir="ltr">Hi Elisa,<div><br></div><div>I'm not an expert, but let me try to help you. It is a bit difficult to know how to adapt this script to your data without knowing what your data looks like.</div><div>Maybe you have already done so, but I think to make scripting easier it is important to acquaint yourself with the EEG structure. Just look around all the variables (especially in EEG.event for this case particularly) to see how they are all related to each other and what kind of information is in them (string, double, etc).</div><div><br></div><div>What you want this script to do is find all the events labeled '13', find their latency and then use those latencies to calculate the latencies for your added events, right? In the example script, the event label is a string, so it uses strcmp which compares the given string ('A') to the strings in EEG.event.type. If your event is not a string, then you shouldn't use strcmp, but just work with the number 13.</div><div><br></div><div>I hope this at least in part helps you towards a solution.</div><div><br></div><div>cheers,</div><div>Raquel</div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">--<div>Dragón de la Patagonia</div><div>Ramon Barros Luco 688<br>Puerto Natales - Patagonia - Chile <br>Oficina: +56-9-94022038</div><div>Skype: raquel.london</div><div><br></div></div></div></div>
<br><div class="gmail_quote">On Sun, Oct 2, 2016 at 2:32 PM, Elisa Tatti <span dir="ltr"><<a href="mailto:elisatatti@msn.com" target="_blank">elisatatti@msn.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


<div class="m_608195978586061534hmmessage"><div dir="ltr"><div><div dir="ltr"><font size="3">Dear EEGLAB users,</font><div><font size="3"><br></font></div><div><span style="background-color:rgb(255,255,255)"><span style="line-height:21.3px"><font size="3">We have  EEG recordings with several markers and I would like to add an event coded "33" 2.5 seconds after the onset of all the events "13".</font></span></span></div><div><span style="background-color:rgb(255,255,255)"><span style="line-height:21.3px"><font size="3">In the EEGLABlist I read about a script to add events on the base of an already existent one but it doesn't work on my data (A_latencies is empty).  I suppose that this is because my events are coded as numbers and the examples provided here were with "characters" (see below):</font></span></span></div><div><span style="background-color:rgb(255,255,255)"><span style="line-height:21.3px"><font size="3"><br></font></span></span></div><div><pre style="white-space:pre-wrap"><font size="3">%Get the latencies (data point indices) for all 'A' type events...
A_latencies=[EEG.event(find(<wbr>strcmp('A',{EEG.event.type})))<wbr>.latency];

%for each A_latencies add a new event type '1' with a latency of (A_latencies(i)+1.5*EEG.srate)<wbr>-1...
for i=1:length(A_latencies);
    n_events=length(EEG.event);
    EEG.event(n_events+1).type='1'<wbr>;
    EEG.event(n_events+1).latency=<wbr>(A_latencies(i)+1.5*EEG.srate)<wbr>-1;
    EEG.event(n_events+1).urevent=<wbr>n_events+1;
end

%check for consistency and reorder the events chronologically...
EEG=eeg_checkset(EEG,'<wbr>eventconsistency');
</font></pre></div><div><font size="3"><br></font></div><div><span style="background-color:rgb(255,255,255)"><span style="line-height:21.3px"><font size="3"><br></font></span></span></div><div><span style="line-height:21.3px;background-color:rgb(255,255,255)"><font size="3">I am starting learning matlab now, so I don't know how to adapt this script to my data. Can someone help me?!</font></span></div><div><font size="3"><br></font></div><div><span style="line-height:21.3px"><font size="3">Thank you for your consideration.</font></span></div><span class="HOEnZb"><font color="#888888"><div><span style="line-height:21.3px"><font size="3"><br></font></span></div><div><span style="line-height:21.3px"><font size="3"><br></font></span></div><div><span style="line-height:21.3px"><font size="3">Elisa</font></span></div><div><font color="#444444"><span style="font-size:15px;line-height:21.3px"><br></span></font></div>                                     </font></span></div></div>                                      </div></div>
<br>______________________________<wbr>_________________<br>
Eeglablist page: <a href="http://sccn.ucsd.edu/eeglab/eeglabmail.html" rel="noreferrer" target="_blank">http://sccn.ucsd.edu/eeglab/<wbr>eeglabmail.html</a><br>
To unsubscribe, send an empty email to <a href="mailto:eeglablist-unsubscribe@sccn.ucsd.edu">eeglablist-unsubscribe@sccn.<wbr>ucsd.edu</a><br>
For digest mode, send an email with the subject "set digest mime" to <a href="mailto:eeglablist-request@sccn.ucsd.edu">eeglablist-request@sccn.ucsd.<wbr>edu</a><br></blockquote></div><br></div>