Back to the main page.

Bug 1761 - nanstd breaks ft_statfun_indepsamplesT because it expects less input arguments (than std)

Status CLOSED FIXED
Reported 2012-10-02 13:10:00 +0200
Modified 2012-10-05 08:23:47 +0200
Product: FieldTrip
Component: core
Version: unspecified
Hardware: PC
Operating System: Windows
Importance: P3 normal
Assigned to: Boris Reuderink
URL:
Tags:
Depends on:
Blocks:
See also:

Stephen Whitmarsh - 2012-10-02 13:10:16 +0200

Error occured in Tineke's analysis. Error in ==> ft_statfun_indepsamplesT at 79 var1 = nanstd(dat(:,sel1), 0, 2).^2; This can be reproduced with the following code and attached data: cfg = []; cfg.channel = {'MEG'}; cfg.latency = [-1.0 1.0]; cfg.frequency = [17 27]; cfg.avgoverfreq = 'yes'; cfg.avgovertime = 'no'; cfg.method = 'montecarlo'; cfg.statistic = 'indepsamplesT'; cfg.correctm = 'cluster'; cfg.clusteralpha = 0.05; cfg.clusterstatistic = 'maxsum'; cfg.minnbchan = 2; cfg.tail = 0; cfg.clustertail = 0; cfg.alpha = 0.05; cfg.numrandomization = 500; % prepare_neighbours determines what sensors may form clusters cfg_neighb.method = 'distance'; cfg.neighbours = ft_prepare_neighbours(cfg_neighb, testdata_a); design = zeros(1,size(testdata_a.powspctrm,1) + size(testdata_b.powspctrm,1)); design(1,1:size(testdata_a.powspctrm,1)) = 1; design(1,(size(testdata_a.powspctrm,1)+1):(size(testdata_b.powspctrm,1)+size(testdata_a.powspctrm,1))) = 2; cfg.design = design; cfg.ivar = 1; [stat] = ft_freqstatistics(cfg, testdata_a, testdata_b);


Stephen Whitmarsh - 2012-10-02 13:13:46 +0200

Created attachment 335 testdata_a and testdata_b


Stephen Whitmarsh - 2012-10-02 13:14:26 +0200

??? Error using ==> statfun/private/nanstd Too many input arguments. Error in ==> ft_statfun_indepsamplesT at 79 var1 = nanstd(dat(:,sel1), 0, 2).^2;


Arjen Stolk - 2012-10-02 13:34:08 +0200

Boris dealt with perhaps similar problems related to other nan functions yesterday. I have therefore forwarded this bug to Boris.


Boris Reuderink - 2012-10-03 10:05:30 +0200

I am sorry, that is indeed a use of nanstd that I did not forsee. I am working on a fix. In the mean time, you can safely delete the nan* mex files. This causes MATLAB to look for the ones in the Statistics Toolbox.


Stephen Whitmarsh - 2012-10-03 10:15:48 +0200

Thanks!


Boris Reuderink - 2012-10-03 14:45:25 +0200

It should be fixed now. What is missing from the new version: 1) variance on complex-valued arrays (gives a clear error message), 2) using a weight *vector* as the second argument. Issue (2) was not supported by JM's version either, and does not seem to be used in the FT code base. Issue (1) is probably rare as well, but I am working on a fix.


Boris Reuderink - 2012-10-03 20:40:55 +0200

Fixed handling of complex numbers in SVN revision r6653.


Boris Reuderink - 2012-10-05 08:23:47 +0200

Tineke confirmed that the problem is indeed solved. Therefore, I close this bug.