[FieldTrip] ft_spikedensity

"Jörn M. Horschig" jm.horschig at donders.ru.nl
Mon Dec 16 09:25:35 CET 2013

Dear Santiago,

maybe you forgot to call ft_defaults prior to doing anything with 
Fieldtrip? Fieldtrip has an own nearest function, which needs *at least* 
two input arguments. Calling ft_defaults should add the necessary paths 
so that Matlab knows which nearest function to use.
You can also easily verify this by calling
which nearest
in the command window. If this refers to a Fieldtrip function, you are 
fine. However, from what you describe, the path is not set correctly and 
this will refer to some function outside Fieldtrip.


On 12/13/2013 6:06 PM, Santiago Torres, Mr wrote:
> Hello All,
> I am trying to run the spike analysis script ft_spikedensity and have 
> the following problem:
> When defining the begSample variable in line 234 of the code:
>   begSample  = nearest(timeAxis, cfg.latency(1))
> Error using nearest
> Too many input arguments.
> the code is set such that it inputs two variables to the function 
> nearest, which only allows for one variable as input. This should 
> always give an error independent of the variables that are given to 
> nearest. I tried to do a temporary fix by eliminating the second input 
> which seems unnecessary (given that further code uses the values in 
> the timeAxis matrix only) or by making a matrix using cfg.latency(1) 
> as the final value of nearest(timeAxis). Neither of this options work 
> as they give a bigger sampleSel than timeAxis 
> (sampleSel(sampleSel>length(timeAxis)) = []). However, I do not want 
> to mess with something that may have other implications further down, 
> and I assume the second variable (cf.latency(1)) is there for a 
> reason. Can someone help explain how to go around this problem or why 
> it may not be working?
> timeAxis is a 1*n double matrix with increasing positive time values 
> starting at 0. cfg.latency(1) is 0. I am using a 32-bit matlab version 
> R2012a.
> Thanks,
> Santiago Torres
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip

Jörn M. Horschig
PhD Student
Donders Institute for Brain, Cognition and Behaviour
Centre for Cognitive Neuroimaging
Radboud University Nijmegen
Neuronal Oscillations Group
FieldTrip Development Team

P.O. Box 9101
NL-6500 HB Nijmegen
The Netherlands

E-Mail: jm.horschig at donders.ru.nl
Tel:    +31-(0)24-36-68493
Web: http://www.ru.nl/donders

Visiting address:
Trigon, room 2.30
Kapittelweg 29
NL-6525 EN Nijmegen
The Netherlands

More information about the fieldtrip mailing list