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

W. Saad ab_saad at LIVE.COM
Wed May 26 12:09:44 CEST 2010


Hi,

I am new to matlab and FieldTrip - so bare with me and thanks for your feedback in advance :)

I have a csv file containing readings for 25 electrode EEG trial. There are 129,908 readings in
the file (sampling rate is 256 - approx. 507 seconds) The file is 25 columns by 129,908 rows.

I would like to calculate power for each of the 5 wave types for each channel. Also, I would
like to find the coherence for all intra-hemispheric and inter-hemispheric pairwise
combination of the 25 channels (300 in total).

I am trying the following code but getting a memory error and other errors (code is mostly based
on the samples I have found in FieldTrip website).


%--------------------------------------------------------------

fieldtripdefs;
 
filename='recall.dat';
filelength=129908;
rdata=csvread(filename);
rdata=rdata';

% 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 
timevector = [1:filelength];
data.time = { timevector };

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

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

% Let us not draw for now..
%cfg                  = [];
%cfg.xparam           = 'freq';
%cfg.zparam           = 'cohspctrm';
%cfg.xlim             = [5 80];
%cfg.cohrefchannel    = 'EMGlft';
%cfg.layout           = 'CTF151.lay';
%cfg.showlabels       = 'yes';
%figure; ft_multiplotER(cfg, fd)

-----------------------------------------------------------------

The messages/error I get is:

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 29
freq           = ft_freqanalysis(cfg, data);

-----------------------------------------------------------------

I have been looking around in the discussion board trying to find how to read a csv file with no success (though it looks to me it 
was read successfully since Fieldtrip detected it has 25 channels).

Also, I am worried about the message 
??? Maximum variable size allowed by the program is exceeded.
Because most of my trials are huge in size, in fact the biggest file size I have is 25 columns x 250,000 rows (~60MB).

Your input is highly appreciated.

Thanks. 		 	   		  
_________________________________________________________________
30 days of prizes to be won with Hotmail.  Enter Here.
http://go.microsoft.com/?linkid=9729709
----------------------------------
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 http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20100526/38a3aa88/attachment-0001.html>


More information about the fieldtrip mailing list