[Eeglablist] Latency of peak amplitude by bin

Morett, Laura laura.morett at yale.edu
Sat Apr 15 09:39:55 PDT 2017


Dear colleagues,
I would like to measure the latency of the absolute peak amplitude (max or min) of a waveform within trial epochs for each condition (bin).  I found some code from a previous post about how to measure peak amplitude latency that I was able to get to work, but I have been unable to figure out how to measure it for each bin specifically.  I’ve tried using pop_selectevent() to loop through and select each bin, but it doesn’t seem to be working as the same peak amplitude values are being returned for each iteration.  Also, I’ve noticed that that the loop only returns values for 3 iterations, despite that there are 4 bins.  If anyone can provide any insight into how I can restrict latency measurements by bin, I would greatly appreciate it if you would be willing to share it with me.  My code is below.

Best wishes,
Laura Morett


bin_list = 1:4 % bins
nbin = length(bin_list); % number of bins

        % Get latency of amplitude peaks in trial
        for b=1:nbin
            EEG_select = pop_selectevent( EEG, 'bini',bin_list(b),'deleteevents','off','deleteepochs','on','invertepochs','off');
            for ch=1:nchan % Loop through all channels
                channel_idx = channel_list(ch); % select channel
                time_window = [-300 1200]; % epoch to test (trial duration)
                samples = find(EEG_select.times >= time_window(1) & EEG_select.times <= time_window(2)); % the samples to test
                data = EEG_select.data( channel_idx, samples ); % pull out the data for this channel, and time window
peak_latency = channel_list(ch), EEG_select.times( samples( find( data==max(data) )  ) ); % get the peak latency in this window (max() can be replaced with min() for a negative peak)
            end
        end


********************************************************
Laura M. Morett
Hilibrand Postdoctoral Fellow
Yale Child Study Center
230 S. Frontage Rd.
New Haven, CT 06520

As of August 16, 2017:
Assistant Professor of Educational Psychology
Educational Neuroscience Initiative
University of Alabama
Box 870231
Tuscaloosa, AL 35487-0231

Email: laura.morett at yale.edu<mailto:laura.morett at yale.edu>
Phone: (203) 737-4586
Web: http://lauramorett.strikingly.com/<https://urldefense.proofpoint.com/v2/url?u=http-3A__lauramorett.strikingly.com_&d=CwMF-g&c=-dg2m7zWuuDZ0MUcV7Sdqw&r=7RydtjFxlOLitiTKeuyufwjZVnuS2cr0LD3ZBHQd6QA&m=hcKHc9qk081CzOBRcCJRuXs-41-8mLMuX9gmiw_QG_g&s=UQlF7t1IaNyCaJW5l4lvUXFZvEYnMtD2_GIYvnLLIaE&e=>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://sccn.ucsd.edu/pipermail/eeglablist/attachments/20170415/2ddb8653/attachment.html>


More information about the eeglablist mailing list