Back to the main page.
Bug 2110 - ft_spiketriggeredaverage doesn't correctly select trials
Status | CLOSED FIXED |
Reported | 2013-04-11 16:03:00 +0200 |
Modified | 2019-08-10 12:03:53 +0200 |
Product: | FieldTrip |
Component: | spike |
Version: | unspecified |
Hardware: | PC |
Operating System: | Windows |
Importance: | P3 normal |
Assigned to: | Martin Vinck |
URL: | |
Tags: | |
Depends on: | |
Blocks: | |
See also: |
Teresa Madsen - 2013-04-11 16:03:33 +0200
I originally had (15) long trials (150 seconds) that each had partial artifact rejections, resulting in many (90) shorter trials which may or may not include the trigger event. So when I tried to run a spike-triggered average on a time window around the trigger (just happened to be the first thing I tried, don't know if other analyses will have the same problem), it seems to get confused about which trials to use, eventually throwing this error: >> processing trial 15 of 90 (16 spikes) >> Index exceeds matrix dimensions. >> Error in ft_spiketriggeredaverage (line 157) >> spikesmp = find(data.trial{i}(spikesel,:)); It turns out that the line >> data = ft_selectdata(cfgSelect,data); correctly cut the data down to the subset of 15 trials that contained the trigger event and desired latencies, but the loop >> for i=1:ntrial is still based on the original number of (90) trials. I also tried preselecting those trials by listing their indices in cfg.trials, but it gave the exact same error, since ntrial is defined by >> ntrial = length(data.trial); before ft_selectdata is called. I imagine that's probably the fix: just redefine ntrial again after ft_selectdata. Thanks, Teresa
Martin Vinck - 2013-04-11 16:07:58 +0200
Hi Teresa You are right. This is something of a recent release, I guess, because I didn't see this selectdata piece of code before. I'll correct it.
Martin Vinck - 2013-04-11 16:11:16 +0200
redefined ntrial after selectdata, should fix the bug.
Martin Vinck - 2013-04-11 16:11:24 +0200
committed