<div dir="ltr">

<p class=""><span style lang="EN-US">Hi:</span></p>

<p class=""><span style lang="EN-US"> I am new to
EEGLAB and I encountered a problem while trying to generate a script for MATLAB
that invokes both EEGLAB and ERPLAB. Being this a problem mainly concerned with
ERPLAB, I am not sure this list is the proper channel to ask for suggestions,
but here it goes anyway.</span></p>

<p class=""><span style lang="EN-US">With quite a deal of help, I finally generated
the following script, which by the way works fine:</span></p>

<p class=""><span style lang="EN-US"> </span></p>

<p class="" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-family:"Courier New"" lang="EN-US">for ni=1:2%3</span></p>

<p class="" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-family:"Courier New"" lang="EN-US"><span style>    </span>dir_root = ['Ins' num2str(ni)];</span></p>

<p class="" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-family:"Courier New"" lang="EN-US"><span style>    </span>for nb=1% número del bloque a analizar</span></p>

<p class="" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-family:"Courier New"" lang="EN-US"><span style>        </span>filename_list = dir(fullfile(dtdir,
dir_root, ['Bloque ' num2str(nb)], '*.bdf'));</span></p>

<p class="" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-family:"Courier New"" lang="EN-US"><span style>        </span></span></p>

<p class="" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-family:"Courier New"" lang="EN-US"><span style>        </span>% load</span></p>

<p class="" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-family:"Courier New"" lang="EN-US"><span style>        </span>EEG = pop_readbdf(fullfile(dtdir,
dir_root, ['Bloque ' num2str(nb)], filename_list(1).name), [1 622], 41, [37
38]);</span></p>

<p class="" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-family:"Courier New"" lang="EN-US"><span style>     </span><span style>   </span>EEG = eeg_checkset( EEG );</span></p>

<p class="" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-family:"Courier New"" lang="EN-US"><span style>        %</span> channel location<span style>              </span></span></p>

<p class="" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-family:"Courier New"" lang="EN-US"><span style>        </span>EEG=pop_chanedit(EEG, 'lookup','C:\\Program
Files\\MATLAB\\R2008a\\eeglab11_0_4_3b\\plugins\\dipfit2.2\\standard_BESA\\standard-10-5-cap385.elp');</span></p>

<p class="" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-family:"Courier New"" lang="EN-US"> <span style>       </span>% remove cardio</span></p>

<p class="" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-family:"Courier New"" lang="EN-US"><span style>        </span>EEG = pop_select(
EEG,'nochannel',{'EXG7' 'EXG8'});</span></p>

<p class="" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-family:"Courier New"" lang="EN-US"> <span style>       </span>% filter</span></p>

<p class="" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-family:"Courier New"" lang="EN-US"><span style>        </span>EEG = pop_eegfilt( EEG, 0.5, 30, [],
[0], 0, 0, 'fir1', 0);</span></p>

<p class="" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-family:"Courier New"" lang="EN-US"><span style>        </span>% BSS </span></p>

<p class="" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-family:"Courier New"" lang="EN-US"><span style>        </span>EEG = pop_autobsseog( EEG, [622],
[622], 'sobi', {'eigratio', [1000000]}, 'eog_fd', {'range',[2<span style>  </span>8]});</span></p>

<p class="" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-family:"Courier New"" lang="EN-US"><span style>        </span></span></p>

<p class="" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-family:"Courier New"" lang="EN-US"><span style>        </span>% rereference</span></p>

<p class="" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-family:"Courier New"" lang="EN-US"><span style>        </span>EEG = pop_reref( EEG, [37 38] );</span></p>

<p class="" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-family:"Courier New"" lang="EN-US"><span style>        </span></span></p>

<p class="" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-family:"Courier New"" lang="EN-US"><span style>        </span>% remove ocular channels <span style>        </span></span></p>

<p class="" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-family:"Courier New"" lang="EN-US"><span style>        </span>EEG = pop_select(
EEG,'nochannel',{'EXG1' 'EXG2' 'EXG3' 'EXG4'});</span></p>

<p class="" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-family:"Courier New"" lang="EN-US"><span style>        </span></span></p>

<p class="" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-family:"Courier New"" lang="EN-US"><span style>         </span>% set name </span></p>

<p class="" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-family:"Courier New"" lang="EN-US"><span style>        </span>EEG.setname = [dir_root '_b'
num2str(nb)];</span></p>

<p class="" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-family:"Courier New"" lang="EN-US"><span style>       </span><span style>        </span></span></p>

<p class="" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-family:"Courier New"" lang="EN-US"><span style>        </span>% create event list</span></p>

<p class="" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-family:"Courier New"" lang="EN-US"><span style>        </span>EEG = pop_creabasiceventlist( EEG ,
'Eventlist', 'elist.txt', 'Newboundary', { -99 }, 'Stringboundary', {
'boundary' }, 'Warning', 'on' );</span></p>

<p class="" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-family:"Courier New"" lang="EN-US"><span style>        </span></span></p>

<p class="" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-family:"Courier New"" lang="EN-US"><span style>         </span>% binlister</span></p>

<p class="" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-family:"Courier New"" lang="EN-US"><span style>         </span>EEG = pop_binlister( EEG, 'BDF',
binlist, 'ExportEL', [fullfile(bindir,'binlogs_') EEG.setname '.txt'],
'UpdateEEG', 'on', 'Warning', 'on');</span></p>

<p class="" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-family:"Courier New"" lang="EN-US"><span style>         </span></span></p>

<p class="" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-family:"Courier New"" lang="EN-US"><span style>         </span>% epoch data</span></p>

<p class="" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-family:"Courier New"" lang="EN-US"><span style>         </span>EEG = pop_epochbin( EEG , epoch,
'pre');</span></p>

<p class="" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-family:"Courier New"" lang="EN-US"><span style>       </span></span></p>

<p class="" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-family:"Courier New"" lang="EN-US"><span style>         </span>% artifact removal<span style>  </span></span></p>

<p class="" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-family:"Courier New"" lang="EN-US"><span style>         </span>EEG = pop_artmwppth( EEG ,
'Channel',<span style>  </span>1:32, 'Flag',<span style>  </span>1, 'Threshold', 150, 'Twindow', [ 0 600],
'Windowsize',<span style>  </span>200, 'Windowstep',<span style>  </span>100 )</span></p>

<p class="" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-family:"Courier New"" lang="EN-US"><span style>         </span><span style>             </span></span></p>

<p class="" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-family:"Courier New"" lang="EN-US"><span style>         </span>% save .set</span></p>

<p class="" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-family:"Courier New"" lang="EN-US"><span style>         </span>EEG = pop_saveset( EEG,<span style>  </span>'filename', [EEG.setname '.set'], 'filepath',
wkdir); </span></p>

<p class="" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-family:"Courier New"" lang="EN-US"><span style>         </span></span></p>

<p class="" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-family:"Courier New"" lang="EN-US"><span style>         </span>% pop average</span></p>

<p class="" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-family:"Courier New"" lang="EN-US"><span style>         </span>ERP = pop_averager( EEG ,
'Criterion', 'good', 'Stdev', 'on' );</span></p>

<p class="" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-family:"Courier New"" lang="EN-US"><span style>         </span></span></p>

<p class="" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-family:"Courier New"" lang="EN-US"><span style>         </span>% save as ERP</span></p>

<p class="" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-family:"Courier New"" lang="EN-US"><span style>          </span>erpname = [EEG.setname '_ERPs'];<span style>  </span>% name for erpset menu</span></p>


<p class="" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-family:"Courier New"" lang="EN-US"><span style>          </span>fname_erp = fullfile(wkdir2, [erpname
'.erp']);</span></p>

<p class="" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-family:"Courier New"" lang="EN-US"><span style>          </span>pop_savemyerp(ERP, 'erpname',
erpname, 'filename', fname_erp);</span></p>

<p class="" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-family:"Courier New"" lang="EN-US"><span style>         </span></span></p>

<p class="" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-family:"Courier New"" lang="EN-US"><span style>         </span></span></p>

<p class="" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-family:"Courier New"" lang="EN-US"><span style>    </span>end</span></p>

<p class="" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-family:"Courier New"" lang="EN-US">end</span></p>

<p class=""><span style lang="EN-US"> </span></p>

<p class=""><span style lang="EN-US">I tested
with two continuous sets of raw data (.bdf files) and everything works fine
with the first set (60 trials are epoched), but the second one consistently ends up with 55 epochs
instead of the 60 epochs specified in the bin file. I checked the binfile and
itīs ok, I inspected the .pcl file (I programmed the experiment in Presentation)
and itīs ok too. </span></p>

<p class=""><span style lang="EN-US">I checked
the binlog output, took notice of the bins that were not found when generating
the bin structure and identified the code events that were missing. Then I
inspected the original raw .bdf file and I found out, that, for no reason that
I can tell, the last 15 or so events are just missing in the binlog output.
This includes the five targets I need to be epoched. Also, there is no visible
reason for this happens, that is, in the .bdf file there is no large gap o
sudden burst or whatever between the last event actually binned and the next
one in the continuous data.</span></p>

<p class=""><span style lang="EN-US">My conclusion
is that the bin structure process stops some 15 to 20 trials BEFORE the actual
end of the continuous data file.</span></p>

<p class=""><span style lang="EN-US">I am
completely clueless about the reason for this. I thought it might have
something to do with the artifact removal and/or flagging, but this step is
programmed to happen AFTER the bin list structure generation and therefore
should affect the binlist generation (even less the binlist output).</span></p>

<p class=""><br><span style lang="EN-US">By the way, I am using EEGLAB 11_04_3b and erplab 3.0.2.1. I will deeply
appreciate any help and I apologize if this particular issue has been discussed
and/or solved before.</span></p>

<p class=""><span style lang="EN-US"><br></span></p><p class=""><span style lang="EN-US"></span></p><p class=""><span style lang="EN-US"></span></p><p class=""><span style lang="EN-US">Cheers</span></p>

<p class=""><span style lang="EN-US"> <br></span></p>

</div>