I'm trying to use the ttest and the signrank functions but they don't work.
When using the ttest function it says:
Undefined function or variable 't'.
Error in nanmean (line 7) N = sum(~isnan(t), dim);
Error in ttest (line 131) xmean = nanmean(x,dim);
and for the signrank it says:
Error using signrank (line 95) SIGNRANK requires vector rather than matrix data.
I have the following toolboxes installed: MATLAB Version 8.2 (R2013b) Signal Processing Toolbox Version 6.20 (R2013b) Statistical Parametric Mapping Version 5236 (SPM8) Statistics Toolbox Version 8.3 (R2013b)
Thank you very much in advance.

1 commentaire

Sorry about that. Here is the code for performing the Wilcoxon Signed-Rank Test on EEG data:
pval = 0.05
all = Alphapower;
dataalpha1 = all(1:3,:,:);
dataalpha2 = all(4:6,:,:);
for channel = 1:19
pre = dataalpha1(:,1,channel);
post = dataalpha2(:,2,channel);
[p, h, stats] = signrank(post, pre, 'alpha', pval);
end

Connectez-vous pour commenter.

 Réponse acceptée

José-Luis
José-Luis le 22 Sep 2014
[p, h, stats] = signrank(squeeze(post), squeeze(pre), 'alpha', pval);

2 commentaires

Eric
Eric le 22 Sep 2014
Thank you for the answer. But does this return values from comparisons for each column (like channel 1 pre compared to channel 1 post)?
No, your code was not working because dataalpha1 and dataalpha2 were not vectors but matrices of size [: 1 1]. Squeeze() just makes them a vector array, which is what the function is expecting. You could also do:
[p, h, stats] = signrank(post(:), pre(:), 'alpha', pval);

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Argument Definitions dans Centre d'aide et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by