<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">several people have suggested solutions for this - thanks to everyone!<br>i'm still having issues understanding a few things in EEGLab scripting, and especially in memory management. <div><br>here is my script:<br><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier; min-height: 14.0px"> <br class="webkit-block-placeholder"></p><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Courier; "><span style="color: #0000ff">for</span> S = [108 109];</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Courier; ">    eeglab</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Courier; color: rgb(160, 32, 240); "><span style="color: #000000">    Cond =[ </span>'LVF_ConTarg_AllCue'<span style="color: #000000">; </span>'LVF_IncTarg_AllCue'<span style="color: #000000">; </span>'RVF_ConTarg_AllCue'<span style="color: #000000">; </span>'RVF_IncTarg_AllCue'<span style="color: #000000"> ];</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Courier; ">    trigs=[110 111 112 113; 120 121 122 123; 210 211 212 213; 220 221 222 223 ]; </div><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier; min-height: 14.0px">  <br class="webkit-block-placeholder"></p><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Courier; ">   <span style="color: #0000ff">for</span> c = 1:4;</div><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier; min-height: 14.0px"> <br class="webkit-block-placeholder"></p><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Courier; color: rgb(34, 139, 34); "><span style="color: #000000">    </span>%load a file, for example 108.set, which is not filtered and uses common vertex reference.  </div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Courier; color: rgb(160, 32, 240); "><span style="color: #000000">    EEG = pop_loadset( </span>'filename'<span style="color: #000000">, [int2str(S),</span>'.set'<span style="color: #000000">], </span>'filepath'<span style="color: #000000">, </span>'/Users/andrew/Documents/Research/DATA/stage/'<span style="color: #000000">);</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Courier; ">    [ALLEEG, EEG, CURRENTSET] = eeg_store( ALLEEG, EEG, 0 );</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Courier; ">    EEG = eeg_checkset( EEG );</div><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier; min-height: 14.0px"> <br class="webkit-block-placeholder"></p><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Courier; color: rgb(34, 139, 34); "><span style="color: #000000">    </span>% re-reference to common average reference, excluding VEOU and VEOL</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Courier; ">    EEG = pop_reref( EEG, [], <span style="color: #a020f0">'refstate'</span>,0, <span style="color: #a020f0">'exclude'</span>,[65 66] )</div><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier; min-height: 14.0px">    <br class="webkit-block-placeholder"></p><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Courier; color: rgb(34, 139, 34); "><span style="color: #000000">    </span>% lookup Channel Locations</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Courier; color: rgb(160, 32, 240); "><span style="color: #000000">    EEG=pop_chanedit(EEG,  </span>'lookup'<span style="color: #000000">, </span>'/Users/andrew/Documents/Research/eeglab2008October01_beta/plugins/dipfit2.2/standard_BESA/standard-10-5-cap385.elp'<span style="color: #000000">);</span></div><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier; min-height: 14.0px">    <br class="webkit-block-placeholder"></p><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Courier; color: rgb(34, 139, 34); "><span style="color: #000000">    </span>% EXTRACT EPOCHS, for trigs relevant to Cond</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Courier; ">    EEG = pop_selectevent( EEG, <span style="color: #a020f0">'event'</span>,trigs(c,:) , <span style="color: #a020f0">'deleteepochs'</span>, <span style="color: #a020f0">'on'</span>);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Courier; ">    [ALLEEG EEG CURRENTSET] = pop_newset(ALLEEG, EEG, 1, <span style="color: #a020f0">'setname'</span>, Cond(c,:), <span style="color: #a020f0">'savenew'</span>, [int2str(S),<span style="color: #a020f0">'_AVGREREF_'</span>,Cond(c,:)], <span style="color: #a020f0">'overwrite'</span>, <span style="color: #a020f0">'on'</span>, <span style="color: #a020f0">'gui'</span>, <span style="color: #a020f0">'off'</span>); </div><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier; min-height: 14.0px">        </p><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Courier; color: rgb(34, 139, 34); "><span style="color: #000000">    </span>%baseline filter using pre-stimulus interval.  </div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Courier; color: rgb(34, 139, 34); ">    %NOT working ->"pop_rmbase(): Wrong point range"</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Courier; ">    %EEG = pop_rmbase( EEG, [-1000  0]);</div><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier; min-height: 14.0px">    <br class="webkit-block-placeholder"></p><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Courier; color: rgb(34, 139, 34); "><span style="color: #000000">    </span>%maybe CLEAR some RAM? NOT working.</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Courier; color: rgb(34, 139, 34); "><span style="color: #000000">    </span>%ALLEEG = pop_delset( ALLEEG, [1] );</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Courier; color: rgb(34, 139, 34); "><span style="color: #000000">    </span>%CURRENTSET = pop_delset()</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Courier; ">    <span style="color: #0000ff">end</span>;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Courier; color: rgb(0, 0, 255); ">end<span style="color: #000000">;</span></div><br>so some strangeness:<br><br>1) when i save a new .set named per the S(ubject) and Cond(ition), the <span class="Apple-style-span" style="font-family: Courier; font-size: 12px; "><span style="color: rgb(160, 32, 240); ">'deleteepochs'</span>, <span style="color: rgb(160, 32, 240); ">'on'</span></span>doesn't seem to work - the file contains ALL the epochs, not just 'trigs' ones specified./<br><br></div><div>2) the pop_rmbase syntax seems to be correct, from my eegh, but when put in a script it throws <span class="Apple-style-span" style="color: rgb(34, 139, 34); font-family: Courier; font-size: 12px; ">"pop_rmbase(): Wrong point range" </span>. and including 'timerange' doesn't help.<br><br></div><div>3) the biggest problem is this script the second time around the loop, e.g. it only produces files for the first condition, first subject.<br><br></div><div>108_AVGREREF_LVF_ConTarg_AllCue.set<br>108_AVGREREF_LVF_ConTarg_AllCue.dat<br><br>and then fails with out of memory errors:</div><div>??? Error using ==> ctranspose<div>Out of memory. Type HELP MEMORY for your options.</div><br>i tried <span class="Apple-style-span" style="color: rgb(34, 139, 34); font-family: Courier; font-size: 12px; ">ALLEEG = pop_delset( ALLEEG, [1] );</span> to clear memory before running through the Condition loop a 2nd time, but this doesn't work.<br>what am i doing wrong? is there any better way to clear the memory before the next loop through?<br></div><div><br>thanks,<br>andrew<br><br>On Jun 18, 2009, at 4:56 PM, Andrew Hill wrote:<br><br><blockquote type="cite"><br></blockquote><blockquote type="cite">does anyone have a simple example script, to open a .set file and<br></blockquote><blockquote type="cite">extract a series of epochs by event types into different files?<br></blockquote><blockquote type="cite"><br></blockquote><br></div></body></html>