Reading a csv file into FieldTrip, calculating power and coherence between channels...

Saad AB ab_saad at LIVE.COM
Wed May 26 21:51:19 CEST 2010


Thanks for your response. That definitely helped!

However, I am still getting an error that does not make a lot of sense to me.

I don't think it has to do with my files size being big since the tutorial
in the following link works with files 4 times bigger than mine (208MB):

Here is the code again for anyone willing to help:

% cell-array containing strings, Nchan X 1
data.label = {'E2' 'E3' 'E4' 'E5' 'E6' 'E7' 'E8' 'E9' 'E10' 'E11' 'E12'
'E13' 'E14' 'E15' 'E16' 'E17' 'E18' 'E19' 'E20' 'E21' 'E22' 'E23' 'E24'
'E25' 'E26'};

% sampling frequency in Hz, single number
data.fsample = 256;

% cell-array containing a data matrix for each trial (1 X Ntrial), each data
matrix is Nchan X Nsamples 
data.trial = {rdata};

% cell-array containing a time axis for each trial (1 X Ntrial), each time
axis is a 1 X Nsamples vector 
data.time{1} = [1:filelength]./data.fsample;

cfg            = [];
cfg.output     = 'powandcsd';
cfg.method     = 'mtmfft';
cfg.foilim     = [0.5 50];
cfg.tapsmofrq  = 5;
cfg.keeptrials = 'yes';    = {'all' };
cfg.channelcmb = {'all' 'all'};
freq           = ft_freqanalysis(cfg, data);

cfg            = [];
cfg.method     = 'coh';
cfg.channelcmb = {'all' 'all'};
fd             = ft_connectivityanalysis(cfg, freq);


and the error:

the input is raw data with 25 channels and 1 trials
??? Maximum variable size allowed by the program is exceeded.

Error in ==> dpss>dpsscalc at 127
E = zeros(N,k(2)-k(1)+1);

Error in ==> dpss at 54
   [E,V] = dpsscalc(N,NW,k);

Error in ==> ft_freqanalysis_mtmfft>double_dpss at 423
tap = dpss(double(a), double(b), varargin{:});

Error in ==> ft_freqanalysis_mtmfft at 249
    tap = double_dpss(numdatbns,numdatbns*(cfg.tapsmofrq./data.fsample))';

Error in ==> ft_freqanalysis at 75
  [freq] = feval(sprintf('ft_freqanalysis_%s',lower(cfg.method)), cfg, data);

Error in ==> saad_fieldtrip at 30
freq           = ft_freqanalysis(cfg, data);


Thanks in advance for your input.

The aim of this list is to facilitate the discussion between users of the FieldTrip  toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also and

More information about the fieldtrip mailing list