Back to the main page.

Bug 3321 - ft_timelockstatistics functionning different from what is said on the wiki and in the help

Status CLOSED FIXED
Reported 2017-07-06 23:36:00 +0200
Modified 2019-08-10 12:41:56 +0200
Product: FieldTrip
Component: core
Version: unspecified
Hardware: Macintosh
Operating System: Mac OS
Importance: P5 normal
Assigned to:
URL:
Tags:
Depends on:
Blocks:
See also:

Arnaud - 2017-07-06 23:36:32 +0200

Hi, I just started using fieldtrip, and while practicing with the tutorial http://www.fieldtriptoolbox.org/development/cluster_permutation_timelock using your template data, I found an error when using ft_timelockstatistics as you say on the tutorial in the Within subjects part, with the same code as in the tutorial: " cfg = []; cfg_neighb = []; cfg_neighb.method = 'distance'; neighbours = ft_prepare_neighbours(cfg_neighb, allsubjFIC{1,1}); cfg.neighbours = neighbours; cfg.channel = {'MEG'}; cfg.latency = [0 1]; cfg.method = 'montecarlo'; cfg.statistic = 'depsamplesT'; cfg.correctm = 'cluster'; cfg.clusteralpha = 0.05; cfg.clusterstatistic = 'maxsum'; cfg.minnbchan = 2; cfg.neighbours = neighbours; % same as defined for the between-trials experiment cfg.tail = 0; cfg.clustertail = 0; cfg.alpha = 0.025; cfg.numrandomization = 500; subj = 10; design = zeros(2,2*subj); for i = 1:subj design(1,i) = i; end for i = 1:subj design(1,subj+i) = i; end design(2,1:subj) = 1; design(2,subj+1:2*subj) = 2; cfg.design = design; cfg.uvar = 1; cfg.ivar = 2; [stat] = ft_timelockstatistics(cfg, allsubjFIC, allsubjFC) " The final command line brings an error: Error using ft_notification (line 314) This function requires timelock data as input. Error in ft_error (line 39) ft_notification(varargin{:}); Error in ft_checkdata (line 495) ft_error('This function requires %s data as input.', str); Error in ft_timelockstatistics (line 85) varargin{i} = ft_checkdata(varargin{i}, 'datatype', 'timelock', 'feedback', 'no'); So I tried to solve it and it seems that varargin take the input datasets allsubjFIC, allsubjFC and create a cell array of only 2 elements. So then when it's send to checkdata it doesn't correspond to the individual files structures and so it's not recognize as a timelock data. I overpassed that using : [stat] = ft_timelockstatistics(cfg, allsubjFIC{:}, allsubjFC{:}) so varargin takes the different individual structures as input and it works. I encounter another issue due to the function using first spm2 or 8 before 12, and so as I am on Matlab 2017 this version of spm are not compatible anymore, I will create another bug report for that. I'm using an OS X Yosemite 10.10.5 and Matlab 2017a. Thank you, Best Regards, Arnaud


Robert Oostenveld - 2017-08-14 15:16:07 +0200

Thanks Comparing this [stat] = ft_timelockstatistics(cfg, allsubjFIC, allsubjFC) to this [stat] = ft_timelockstatistics(cfg, allsubjFIC{:}, allsubjFC{:})\ where the latter works, suggests that the allsubjFIC and allsubjFC data structures are cell arrays, containing a single structure for each subject. The first call (that fails) assumes that they are structures, resulting from ft_timelockgrandaverage with keep individual=yes. This is how we used to organize the data, but that was changed some time ago. The specific call to ft_timelockstatistics with the {:} syntax was apparently forgotten. I fixed it. Please let me know if you see other issues with the tutorial.


Robert Oostenveld - 2019-08-10 12:35:42 +0200

This closes a whole series of bugs that have been resolved (either FIXED/WONTFIX/INVALID) for quite some time. If you disagree, please file a new issue on https://github.com/fieldtrip/fieldtrip/issues.


Robert Oostenveld - 2019-08-10 12:41:56 +0200

This closes a whole series of bugs that have been resolved (either FIXED/WONTFIX/INVALID) for quite some time. If you disagree, please file a new issue on https://github.com/fieldtrip/fieldtrip/issues.