[FieldTrip] error with databrowser after rejecting components in ICA

Tzvetan Popov tzvetan.popov at uni-konstanz.de
Sat Mar 26 10:43:01 CET 2022


Dear Anqi,

The cause for this error is that somewhere during the segmentation a sample at the end of trial N is also at the begin of trial N+1. Hence, you might re-consider your segmentation/trial length.
As for the plotting, you could remove comp = rmfield(comp,’sampleinfo’) and you will be able to plot.
Note, however, the first issue needs a fix.

Good luck
Tzvetan


> On 26 Mar 2022, at 10:10, Lei, A. (Anqi) via fieldtrip <fieldtrip at science.ru.nl> wrote:
> 
> Hello,
>  
> I was performing ICA on my EEG data and the script was running smoothly until I rejected bad components using 'ft_rejectcomponent' – after that I couldn't visualize my data using databrowser and got this error: 
>  
> "Error using ft_fetch_data (line 168)
> some of the requested samples occur twice in the data and have conflicting values"
>  
> This is the script I used for ICA, could you let me know what might be wrong? Thank you so much!
>  
> %% ICA   
> %Decomposition of EEG data
>     cfg            = [];
>     cfg.resamplefs = 150;
>     cfg.detrend    = 'no';
>     data           = ft_resampledata(cfg, data_all);
>     
>     cfg        = [];
>     cfg.method = 'runica'; % this is the default and uses the implementation from EEGLAB
>     comp = ft_componentanalysis(cfg, data);
>     
>     %Identify components reflecting eye artifacts
>     % plot the components for visual inspection
>     figure
>     cfg = [];
>     cfg.component = 1:20;       % specify the component(s) that should be plotted
>     cfg.layout    = 'acticap-64ch-standard2_XZ.mat'; % specify the layout file that should be used for plotting
>     cfg.comment   = 'no';
>     ft_topoplotIC(cfg, comp)
>     
>     %Removing bad artifacts and backprojecting data
>     cfg = [];
>     cfg.component = [1 2]; % e.g. to be removed component(s)
> data_all = ft_rejectcomponent(cfg, comp, data_all);
>  
>     %Display data (this is where the error message occurs)
>     cfg = [];
>     cfg.layout = 'acticap-64ch-standard2_XZ.mat'; % specify the layout file that should be used for plotting
>     cfg.viewmode = 'vertical';
>     ft_databrowser(cfg, data_all);
>     
>     
>  
> Best,
> Anqi
> _______________________________________________
> fieldtrip mailing list
> https://mailman.science.ru.nl/mailman/listinfo/fieldtrip <https://mailman.science.ru.nl/mailman/listinfo/fieldtrip>
> https://doi.org/10.1371/journal.pcbi.1002202 <https://doi.org/10.1371/journal.pcbi.1002202>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20220326/9cf89bb4/attachment.htm>


More information about the fieldtrip mailing list