<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Dear Anqi,<div class=""><br class=""></div><div class="">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.</div><div class="">As for the plotting, you could remove comp = rmfield(comp,’sampleinfo’) and you will be able to plot.</div><div class="">Note, however, the first issue needs a fix.</div><div class=""><br class=""></div><div class="">Good luck</div><div class="">Tzvetan</div><div class=""><br class=""></div><div class=""><div><br class=""><blockquote type="cite" class=""><div class="">On 26 Mar 2022, at 10:10, Lei, A. (Anqi) via fieldtrip <<a href="mailto:fieldtrip@science.ru.nl" class="">fieldtrip@science.ru.nl</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="WordSection1" style="page: WordSection1; caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span style="font-family: Helvetica;" class="">Hello,<o:p class=""></o:p></span></div><div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span style="font-family: Helvetica;" class=""><o:p class=""> </o:p></span></div><div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span style="font-family: Helvetica;" class="">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:<span class="Apple-converted-space"> </span><o:p class=""></o:p></span></div><div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span style="font-family: Helvetica;" class=""><o:p class=""> </o:p></span></div><div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span style="font-family: Helvetica;" class="">"Error using ft_fetch_data (line 168)<o:p class=""></o:p></span></div><div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span style="font-family: Helvetica;" class="">some of the requested samples occur twice in the data and have conflicting values"<o:p class=""></o:p></span></div><div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span style="font-family: Helvetica;" class=""><o:p class=""> </o:p></span></div><div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span style="font-family: Helvetica;" class="">This is the script I used for ICA, could you let me know what might be wrong? Thank you so much!<o:p class=""></o:p></span></div><div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span style="font-family: Helvetica;" class=""><o:p class=""> </o:p></span></div><div style="margin: 0in; font-size: 7.5pt; font-family: Courier; color: rgb(2, 128, 9); text-indent: 0.25in;" class="">%% ICA<span class="apple-converted-space"><span style="" class="">   <o:p class=""></o:p></span></span></div><div style="margin: 0in; font-size: 7.5pt; font-family: Courier; color: rgb(2, 128, 9); text-indent: 0.25in;" class="">%Decomposition of EEG data<o:p class=""></o:p></div><div style="margin: 0in; font-size: 7.5pt; font-family: Courier;" class=""><span class="apple-converted-space">   <span class="Apple-converted-space"> </span></span>cfg<span class="apple-converted-space">           <span class="Apple-converted-space"> </span></span>= [];<o:p class=""></o:p></div><div style="margin: 0in; font-size: 7.5pt; font-family: Courier;" class=""><span class="apple-converted-space">   <span class="Apple-converted-space"> </span></span>cfg.resamplefs = 150;<o:p class=""></o:p></div><div style="margin: 0in; font-size: 7.5pt; font-family: Courier;" class=""><span class="apple-converted-space">   <span class="Apple-converted-space"> </span></span>cfg.detrend<span class="apple-converted-space">   <span class="Apple-converted-space"> </span></span>=<span class="Apple-converted-space"> </span><span class="s2" style="color: rgb(170, 4, 249);">'no'</span>;<o:p class=""></o:p></div><div style="margin: 0in; font-size: 7.5pt; font-family: Courier;" class=""><span class="apple-converted-space">   <span class="Apple-converted-space"> </span></span>data<span class="Apple-converted-space"> </span><span class="apple-converted-space">         <span class="Apple-converted-space"> </span></span>= ft_resampledata(cfg, data_all);<o:p class=""></o:p></div><div style="margin: 0in; font-size: 7.5pt; font-family: Courier;" class=""><span class="apple-converted-space">    </span><o:p class=""></o:p></div><div style="margin: 0in; font-size: 7.5pt; font-family: Courier;" class=""><span class="apple-converted-space">   <span class="Apple-converted-space"> </span></span>cfg<span class="apple-converted-space">       <span class="Apple-converted-space"> </span></span>= [];<o:p class=""></o:p></div><div style="margin: 0in; font-size: 7.5pt; font-family: Courier; color: rgb(2, 128, 9);" class=""><span class="apple-converted-space"><span style="" class="">   <span class="Apple-converted-space"> </span></span></span><span class="s1" style="">cfg.method =<span class="Apple-converted-space"> </span></span><span class="s2" style="color: rgb(170, 4, 249);">'runica'</span><span class="s1" style="">;<span class="Apple-converted-space"> </span></span>% this is the default and uses the implementation from EEGLAB<o:p class=""></o:p></div><div style="margin: 0in; font-size: 7.5pt; font-family: Courier;" class=""><span class="apple-converted-space">   <span class="Apple-converted-space"> </span></span>comp = ft_componentanalysis(cfg, data);<o:p class=""></o:p></div><div style="margin: 0in; font-size: 7.5pt; font-family: Courier;" class=""><span class="apple-converted-space">    <o:p class=""></o:p></span></div><div style="margin: 0in; font-size: 7.5pt; font-family: Courier; color: rgb(2, 128, 9);" class=""><span class="apple-converted-space"><span style="" class="">   <span class="Apple-converted-space"> </span></span></span>%Identify components reflecting eye artifacts<o:p class=""></o:p></div><div style="margin: 0in; font-size: 7.5pt; font-family: Courier; color: rgb(2, 128, 9);" class=""><span class="apple-converted-space"><span style="" class="">   <span class="Apple-converted-space"> </span></span></span>% plot the components for visual inspection<o:p class=""></o:p></div><div style="margin: 0in; font-size: 7.5pt; font-family: Courier;" class=""><span class="apple-converted-space">   <span class="Apple-converted-space"> </span></span>figure<o:p class=""></o:p></div><div style="margin: 0in; font-size: 7.5pt; font-family: Courier;" class=""><span class="apple-converted-space">   <span class="Apple-converted-space"> </span></span>cfg = [];<o:p class=""></o:p></div><div style="margin: 0in; font-size: 7.5pt; font-family: Courier; color: rgb(2, 128, 9);" class=""><span class="apple-converted-space"><span style="" class="">   <span class="Apple-converted-space"> </span></span></span><span class="s1" style="">cfg.component = 1:20;<span class="Apple-converted-space"> </span></span><span class="apple-converted-space"><span style="" class="">     <span class="Apple-converted-space"> </span></span></span>% specify the component(s) that should be plotted<o:p class=""></o:p></div><div style="margin: 0in; font-size: 7.5pt; font-family: Courier; color: rgb(2, 128, 9);" class=""><span class="apple-converted-space"><span style="" class="">   <span class="Apple-converted-space"> </span></span></span><span class="s1" style="">cfg.layout</span><span class="apple-converted-space"><span style="" class="">   <span class="Apple-converted-space"> </span></span></span><span class="s1" style="">=<span class="Apple-converted-space"> </span></span><span class="s2" style="color: rgb(170, 4, 249);">'acticap-64ch-standard2_XZ.mat'</span><span class="s1" style="">;<span class="Apple-converted-space"> </span></span>% specify the layout file that should be used for plotting<o:p class=""></o:p></div><div style="margin: 0in; font-size: 7.5pt; font-family: Courier;" class=""><span class="apple-converted-space">   <span class="Apple-converted-space"> </span></span>cfg.comment<span class="Apple-converted-space"> </span><span class="apple-converted-space"> <span class="Apple-converted-space"> </span></span>=<span class="Apple-converted-space"> </span><span class="s2" style="color: rgb(170, 4, 249);">'no'</span>;<o:p class=""></o:p></div><div style="margin: 0in; font-size: 7.5pt; font-family: Courier;" class=""><span class="apple-converted-space">   <span class="Apple-converted-space"> </span></span>ft_topoplotIC(cfg, comp)<o:p class=""></o:p></div><div style="margin: 0in; font-size: 7.5pt; font-family: Courier;" class=""><span class="apple-converted-space">    </span><o:p class=""></o:p></div><div style="margin: 0in; font-size: 7.5pt; font-family: Courier; color: rgb(2, 128, 9);" class=""><span class="apple-converted-space"><span style="" class="">   <span class="Apple-converted-space"> </span></span></span>%Removing bad artifacts and backprojecting data<o:p class=""></o:p></div><div style="margin: 0in; font-size: 7.5pt; font-family: Courier;" class=""><span class="apple-converted-space">   <span class="Apple-converted-space"> </span></span>cfg = [];<o:p class=""></o:p></div><div style="margin: 0in; font-size: 7.5pt; font-family: Courier;" class=""><span class="apple-converted-space">   <span class="Apple-converted-space"> </span></span>cfg.component = [1 2];<span class="Apple-converted-space"> </span><span class="s4" style="color: rgb(2, 128, 9);">% e.g. to be removed component(s)</span><o:p class=""></o:p></div><div style="margin: 0in; font-size: 7.5pt; font-family: Courier; text-indent: 0.25in;" class="">data_all = ft_rejectcomponent(cfg, comp, data_all);<o:p class=""></o:p></div><div style="margin: 0in; font-size: 7.5pt; font-family: Courier; text-indent: 0.25in;" class=""><o:p class=""> </o:p></div><div style="margin: 0in; font-size: 7.5pt; font-family: Courier; color: rgb(2, 128, 9);" class=""><span class="apple-converted-space"><span style="" class="">   <span class="Apple-converted-space"> </span></span></span>%Display data (this is where the error message occurs)<o:p class=""></o:p></div><div style="margin: 0in; font-size: 7.5pt; font-family: Courier;" class=""><span class="apple-converted-space">   <span class="Apple-converted-space"> </span></span>cfg = [];<o:p class=""></o:p></div><div style="margin: 0in; font-size: 7.5pt; font-family: Courier; color: rgb(2, 128, 9);" class=""><span class="apple-converted-space"><span style="" class="">   <span class="Apple-converted-space"> </span></span></span><span class="s1" style="">cfg.layout =<span class="Apple-converted-space"> </span></span><span class="s2" style="color: rgb(170, 4, 249);">'acticap-64ch-standard2_XZ.mat'</span><span class="s1" style="">;<span class="Apple-converted-space"> </span></span>% specify the layout file that should be used for plotting<o:p class=""></o:p></div><div style="margin: 0in; font-size: 7.5pt; font-family: Courier;" class=""><span class="apple-converted-space">   <span class="Apple-converted-space"> </span></span>cfg.viewmode =<span class="Apple-converted-space"> </span><span class="s2" style="color: rgb(170, 4, 249);">'vertical'</span>;<o:p class=""></o:p></div><div style="margin: 0in; font-size: 7.5pt; font-family: Courier;" class=""><span class="apple-converted-space">   <span class="Apple-converted-space"> </span></span>ft_databrowser(cfg, data_all);<o:p class=""></o:p></div><div style="margin: 0in; font-size: 7.5pt; font-family: Courier;" class=""><span class="apple-converted-space">    </span><o:p class=""></o:p></div><div style="margin: 0in; font-size: 7.5pt; font-family: Courier;" class=""><span class="apple-converted-space">    </span><o:p class=""></o:p></div><div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span style="font-family: Helvetica;" class=""><o:p class=""> </o:p></span></div><div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span style="font-family: Helvetica;" class="">Best,<o:p class=""></o:p></span></div><div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span style="font-family: Helvetica;" class="">Anqi<o:p class=""></o:p></span></div></div><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">_______________________________________________</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">fieldtrip mailing list</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><a href="https://doi.org/10.1371/journal.pcbi.1002202" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">https://doi.org/10.1371/journal.pcbi.1002202</a></div></blockquote></div><br class=""></div></body></html>