# [FieldTrip] Question regarding the function ft_freqstatistics.

Schoffelen, J.M. (Jan Mathijs) janmathijs.schoffelen at donders.ru.nl
Sat Oct 30 15:41:51 CEST 2021

```Hi Laetitia,

My suggestion would be to check the sanity of the data structure, and to check the dimensionality of cfg.design.

Since you handcrafted your numerical data, and don’t give any specifics w.r.t. the metadata (*.dimord, *.freq, *.time, *a.label) of your BigMatdef variable
It’s a mismatch between the data and the design that causes the error.

I don’t understand why you index the cfg.design variable as if it’s a 4D matrix, typically it’s a row vector (or a matrix with a few rows), with the observations in the columns.

Best wishes,
Jan-Mathijs

On 21 Oct 2021, at 09:30, Chauviere, Laetitia via fieldtrip <fieldtrip at science.ru.nl<mailto:fieldtrip at science.ru.nl>> wrote:

Dear FieldTrip users,

I have a question regarding the function ft_freqstatistics.

I would like to do statistics on the powerspectrum data (output of the function ft_freqanalysis) between two conditions (same monkey).

I have the Data Input whose structure corresponds to the output of the function ft_freqanalysis, and the design matrix whose size is the same as the data input (datainput.powspctrm) : size(datainput.powspctrm) = size(cfg.design), and the data to compare are in datainput.powspctrm.

BigMat = NaN(8670,1,182,164);
BigMat (1:2078,1,1:91,1:77) = MM25;             % matrix (trials, channel, freq, time) – 1st condition
BigMat (2079:8670,1,92:182,78:164) = M25;   % matrix (trials, channel, freq, time) – 2nd condition

BigMatdef = PowAllCond_ALLFBS{1,1};     % PowAllCond_ALLFBS{1,1} : output function ft_freqanalysis, so to get the same structure
BigMatdef.powspctrm = BigMat;                      % big matrix (trials, channel,freq,time) – with the two conditions

cfg.design(1:2078,:,:,:) = 1;         % 1st condition
cfg.design(2079:8670,:,:,:) = 2;   % 2nd condition

However I still have this error message from Matlab:
"Error using ft_freqstatistics (line 294)
the number of observations in the design does not match the number of observations in the data"

Any tip/suggestion?

Many thanks in advance!

Best,
Laetitia.

Dr. Laetitia Chauvière - PhD
Post-Doc - Prof. Singer's lab - Room 303
Max Planck Institute for Brain Research
Deutschordenstr. 46
60528 Frankfurt am Main - Germany
laetitia.chauviere at brain.mpg.de<mailto:laetitia.chauviere at brain.mpg.de>
T: +49 69 96769-272

_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20211030/5d1f1a37/attachment.htm>
```