[FieldTrip] naive questions about resampling and ICA

Andrew Chang changa5 at mcmaster.ca
Mon Mar 7 22:41:52 CET 2016

Dear all,

I am very new to this toolbox, and still trying to figure out how to
prepare my data for analyzing it in Fieldtrip.
I am following the tutorial of this document (
and trying to adapt it to my own data. I got two problems, one is about
resampling and another is about running ICA.

Here is my script:

cfg2 = [];
cfg2.dataset            = 'data\Andrew_EEG_continous1224\SS_CC_1.raw';
cfg2.trialdef.eventtype = 'trigger';
cfg2 = ft_definetrial(cfg2);

cfg2.channel            = 'EEG';
cfg2.continuous         = 'yes';
data2 = ft_preprocessing(cfg2);

The above part seems working, although I am not sure the information in the
cfg2 or data2 was sufficient for subsequent analyses.
Here is the printscreen of these 2 objects:
[image: Inline image 1]

Then run the resampling

% downsample the data to speed up the next step
cfg2 = [];
cfg2.resamplefs = 300;
cfg2.detrend    = 'no';
data2 = ft_resampledata(cfg2, data2);

I got the error message if the 'resamplefs' does not equal to 500, but 500
Hz was my original sampling rate:

Matrix dimensions must agree.

Error in ft_resampledata (line 226)
      data.trial{itr} = data.trial{itr} +

Skipping the resampling and run the ICA directly:

% perform the independent component analysis (i.e., decompose the data)
cfg2        = [];
cfg2.method = 'runica'; % this is the default and uses the implementation

comp = ft_componentanalysis(cfg2,data2);

Here is what MATLAB returns:

the input is raw data with 257 channels and 203 trials
the call to "ft_selectdata" took 0 seconds
baseline correcting data
no scaling applied, since factor is 0
concatenating data...............
concatenated data matrix size 257x203
starting decomposition using runica
runica(): data length (203) < data channels (257)!
Output argument "sphere" (and maybe others) not assigned
during call to "runica".

Error in ft_componentanalysis (line 488)
    [weights, sphere] = runica(dat, optarg{:});

Some additional information:
I am using MATLAB 2015b with Fieldtrip version 20160304

Any help is much appreciated! Thank you all


Andrew Chang
Ph.D. Candidate
Auditory Development Lab
Department of Psychology, Neuroscience & Behaviour
McMaster University
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20160307/8c396626/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 144915 bytes
Desc: not available
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20160307/8c396626/attachment-0001.png>

More information about the fieldtrip mailing list