<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>Thanks Hamish, Joe, and others who have replied. </div><div><br></div><div>I guess memory always will "be an issue".. I'm just surprised that Matlab seems unable to load a 250mb .set file twice without crashing (on a 2.8ghz Mac with 4gb RAM). </div><div>I'll upgrade to 64-bit matlab. In the meantime, I've simplified my script to use pop_epoch within a loop, and save out new files for each series of event types:</div></div><div><br></div><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); ">% Epoch using c, Cond, trigs for named conditions of 4 event codes each</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">for</span> c = [1:4];</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; color: rgb(160, 32, 240); "><span style="color: #000000"> trigs = [{</span>'110'<span style="color: #000000">, </span>'111'<span style="color: #000000">, </span>'112'<span style="color: #000000">, </span>'113'<span style="color: #000000">}; {</span>'120'<span style="color: #000000">, </span>'121'<span style="color: #000000">, </span>'122'<span style="color: #000000">, </span>'123'<span style="color: #000000">}; {</span>'210'<span style="color: #000000">, </span>'211'<span style="color: #000000">, </span>'212'<span style="color: #000000">, </span>'213'<span style="color: #000000">}; {</span>'220'<span style="color: #000000">, </span>'221'<span style="color: #000000">, </span>'222'<span style="color: #000000">, </span>'223'<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; "> OUTEEG = pop_epoch(EEG, <span style="color: #a020f0">'typerange'</span>,trigs(c,:) );</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Courier; "> [ALLEEG, OUTEEG] = pop_newset(ALLEEG, OUTEEG, <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><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><font class="Apple-style-span" color="#0000FF" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px;"><br></span></font></div><div><font class="Apple-style-span" color="#0000FF" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px;"><span class="Apple-style-span" style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; "><div>Only problem is this is throwing the following error:</div><div><br></div><div><div>??? Error using ==> pop_epoch at 371</div><div>pop_epoch(): multiple event types must be entered as {'a', 'cell', 'array'}</div><div><br></div><div>Error in ==> quadtest3brief at 17</div><div> OUTEEG = pop_epoch(EEG, 'typerange',trigs(c,:) );</div><div><br></div><div><div>Even though trigs(c,:)<b> does</b> have a cell array in it...</div><div><br></div></div><div>>> trigs(c,:)</div><div>ans = '110' '111' '112' '113'</div><div><br></div><div><br></div><div>I've also tried something like this, and it produces the same error:</div><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><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Courier; ">trigscellarray = num2cell(trigs) </div><div><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px; "><br></span></font></div><div><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px;"><span class="Apple-style-span" style="font-family: Helvetica; font-size: medium; ">and has this sort of array</span></span></font></div><div><br></div></div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Courier; ">trigscellarray = </div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Courier; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Courier; "> [110] [111] [112] [113]</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Courier; "> [120] [121] [122] [123]</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Courier; "> [210] [211] [212] [213]</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Courier; "> [220] [221] [222] [223]</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Courier; "><br></div></div><div>But still fails with the same error. :/</div><div>Anyone have any ideas?</div><div><br></div><div>Thanks,</div><div>Andrew</div></div></span></span></font></div></div></body></html>