Error during regression Analysis of EEG data
4 views (last 30 days)
Show older comments
I have been trying to run the regression analysis of EEG data and for the regressand(dependant variable) t-test, I tried running the below loop but I keep running into error. Can someone identify where I'm going wrong, please?
for ichan = 1:size(freqres.powspctrm,1)
for ifrq = 1:size(freqres.powspctrm,4)
cfg = [];
cfg.previous = freqres.cfg;
cfg.channel = freqres.label;
cfg.frequency = [2 40];
cfg.method = 'analytic';
cfg.statistic = 'depsamplesT';
cfg.alpha = 0.05;
cfg.tail = 1;
cfg.correctm = 'no';
Nsub = 11;
cfg.design(1,1:2*Nsub) = [ones(1,Nsub) 2*ones(1,Nsub)];
cfg.design(2,1:2*Nsub) = [1:Nsub 1:Nsub];
cfg.ivar = 1; % the 1st row in cfg.design contains the independent variable
cfg.uvar = 2; % the 2nd row in cfg.design contains the subject number
stat = ft_timelockstatistics(cfg,ichan{:}, ifrq{:});
end
end
2 Comments
Geoff Hayes
on 13 Jan 2016
Maazah - what is the error that you are observing? Please describe it and include the full error message. If the behaviour is unexpected, then describe the desired behaviour.
Answers (1)
Walter Roberson
on 13 Jan 2016
Your for loops on ichan and ifrq are over integers, 1 to the size of something. But your call has
stat = ft_timelockstatistics(cfg,ichan{:}, ifrq{:});
the {:} is only valid for cell arrays, but you are using {:} on those integers.
Your size are over freqres.powspctrm which must be at least 4 dimensional, so it is not obvious to me what you would be trying to index as a cell array. Maybe
stat = ft_timelockstatistics(cfg, freqres.powspctrm{ichan, :, :, ifrq})
0 Comments
See Also
Categories
Find more on EEG/MEG/ECoG in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!