<div dir="ltr"><div>Dear all,</div><div><br></div><div>I am very new to this toolbox, and still trying to figure out how to prepare my data for analyzing it in Fieldtrip. </div><div>I am following the tutorial of this document (<a href="http://www.fieldtriptoolbox.org/example/use_independent_component_analysis_ica_to_remove_eog_artifacts">http://www.fieldtriptoolbox.org/example/use_independent_component_analysis_ica_to_remove_eog_artifacts</a>), and trying to adapt it to my own data. I got two problems, one is about resampling and another is about running ICA.</div><div><br></div><div>Here is my script:</div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><div><font face="monospace, monospace">cfg2 = [];</font></div></div><div><div><font face="monospace, monospace">cfg2.dataset            = 'data\Andrew_EEG_continous1224\SS_CC_1.raw';</font></div></div><div><div><font face="monospace, monospace">cfg2.trialdef.eventtype = 'trigger';</font></div></div><div><div><font face="monospace, monospace">cfg2 = ft_definetrial(cfg2);</font></div></div><div><div><font face="monospace, monospace"><br></font></div></div><div><div><font face="monospace, monospace">cfg2.channel            = 'EEG';</font></div></div><div><div><font face="monospace, monospace">cfg2.continuous         = 'yes';</font></div></div><div><div><font face="monospace, monospace">data2 = ft_preprocessing(cfg2);</font></div></div></blockquote>The above part seems working, although I am not sure the information in the <font face="monospace, monospace">cfg2</font> or <font face="monospace, monospace">data2</font> was sufficient for subsequent analyses.<div>Here is the printscreen of these 2 objects:<br></div><div><img src="cid:ii_15353013cdb87dc0" alt="Inline image 1" width="436" height="291"></div><div><br></div><div><br></div><div>Then run the resampling</div><div><br><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><div><font face="monospace, monospace">% downsample the data to speed up the next step</font></div></div><div><div><font face="monospace, monospace">cfg2 = [];</font></div></div><div><div><font face="monospace, monospace">cfg2.resamplefs = 300;</font></div></div><div><div><font face="monospace, monospace">cfg2.detrend    = 'no';</font></div></div><div><div><font face="monospace, monospace">data2 = ft_resampledata(cfg2, data2);</font></div></div></blockquote><div><br></div><div>I got the error message if the <font face="monospace, monospace">'resamplefs'</font> does not equal to 500, but 500 Hz was my original sampling rate:</div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><div><font color="#ff0000">Matrix dimensions must agree.</font></div></div><div><div><font color="#ff0000"><br></font></div></div><div><div><font color="#ff0000">Error in ft_resampledata (line 226)</font></div></div><div><div><font color="#ff0000">      data.trial{itr} = data.trial{itr} +</font></div></div><div><div><font color="#ff0000">      bsl(:,ones(1,numel(data.time{itr})));</font></div></div></blockquote><div><br></div><div><br></div><div>Skipping the resampling and run the ICA directly:</div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><font face="monospace, monospace">% perform the independent component analysis (i.e., decompose the data)</font></div><div><font face="monospace, monospace">cfg2        = [];</font></div><div><font face="monospace, monospace">cfg2.method = 'runica'; % this is the default and uses the implementation from EEGLAB</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">comp = ft_componentanalysis(cfg2,data2); </font></div></blockquote><div>Here is what MATLAB returns:</div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><div><font face="monospace, monospace">the input is raw data with 257 channels and 203 trials</font></div></div><div><div><font face="monospace, monospace">the call to "ft_selectdata" took 0 seconds</font></div></div><div><div><font face="monospace, monospace">baseline correcting data </font></div></div><div><div><font face="monospace, monospace">no scaling applied, since factor is 0</font></div></div><div><div><font face="monospace, monospace">concatenating data...............</font></div></div><div><div><font face="monospace, monospace">concatenated data matrix size 257x203</font></div></div><div><div><font face="monospace, monospace">starting decomposition using runica</font></div></div><div><div><font face="monospace, monospace">runica(): data length (203) < data channels (257)!</font></div></div><div><div><font face="monospace, monospace">Output argument "sphere" (and maybe others) not assigned</font></div></div><div><div><font face="monospace, monospace">during call to "runica".</font></div></div><div><div><font face="monospace, monospace"><br></font></div></div><div><div><font face="monospace, monospace" color="#ff0000">Error in ft_componentanalysis (line 488)</font></div></div><div><div><font face="monospace, monospace" color="#ff0000">    [weights, sphere] = runica(dat, optarg{:});</font></div></div></blockquote><div><br></div><div><br></div><div>Some additional information:</div><div>I am using MATLAB 2015b with Fieldtrip version 20160304</div><br><div><br></div><div>Any help is much appreciated! Thank you all</div><div><br></div><div>Best,</div><div>Andrew<br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><font color="#666666">Andrew Chang<br>Ph.D. Candidate<br>Auditory Development Lab</font><div><font color="#666666">Department of Psychology, Neuroscience & Behaviour<br>McMaster University</font></div><div><a href="http://changa5.wordpress.com/" target="_blank">http://changa5.wordpress.com/</a><font color="#666666"><br></font></div></div></div></div></div></div></div></div>