Oops, sorry, I noticed that I didn't include negation in the checking script.<div>It should be:</div><div><br></div><div><div>types = unique({EEG.event.type});</div><div>which_have_spaces = ~cellfun(@isempty, regexp(types, ' '));</div>
<div>types_with_spaces = types(which_have_spaces);</div><div><br></div></div><div><br></div><div>If you then need to remove spaces from event.types you could try:</div><div><br></div><div>for i = 1:length(EEG.event)</div>
<div>if ischar(EEG.event(i).type)</div><div>EEG.event(i).type = strtrim(EEG.event(i).type);</div><div>end</div><div>end</div><div><br></div><div>(and the same for EEG.urevent)</div><div><br></div><div>and then you could execute:</div>
<div><span class="Apple-style-span" style="font-family:Helvetica;background-color:rgb(252,255,255);font-size:medium">[ALLEEG EEG] = eeg_store(ALLEEG, EEG, CURRENTSET);</span></div><div><br></div><div><br></div><div>This should at least help with the pop_epoch error.</div>
<div>The code above will work for one dataset only,<br>if you want to update all loaded datasets, you<br>would have to loop through these sets, for example<br>by embracing the code above with:<br><br><div><div>for a = 1:length(ALLEEG)</div>
<div>[EEG ALLEEG CURRENTSET] = eeg_retrieve( ALLEEG, a);</div><div>% and here the previous code looping through events and urevents</div></div></div><div>end</div><div><br clear="all">Mikolaj<br>
<br><br><br><div class="gmail_quote">2012/9/15 Mikołaj Magnuski <span dir="ltr"><<a href="mailto:imponderabilion@gmail.com" target="_blank">imponderabilion@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><br></div><div>Becky,</div><div><br></div><div>It may be relevant to your problem that at least one of</div><div>your event types has trailing spaces (the one that you</div><div>presented as example - 55).</div><div>
<br>
</div><div>As you wrote matlab displays the type as:</div><div>type: '55 '</div><div><br></div><div>which means there are two spaces after two five characters.</div><div>I'm not sure if it should make any difference for</div>
<div>EEGLAB in displaying event types, but it could cause</div><div>the error you report (empty epoch range), because you</div><div>may not have any '55' event types, but '55 ' instead.</div><div><br></div>
<div>You may do a quickcheck of this by coping the following code:</div><div><br></div><div>types = unique({EEG.event.type});</div><div>which_have_spaces = cellfun(@isempty, regexp(types, ' '));</div><div>if ~isempty(which_have_spaces)</div>
<div>types_with_spaces = types(which_have_spaces);</div><div>end</div><div><br></div><div>If this is the case you could then deblank all the events</div><div>and urevents by looping through them and see if it makes</div>
<div>
any difference.</div><div>Anyway, once you find your spaced event types, you could</div><div>also try using pop_epoch again, but with correct event</div><div>types.</div><div><br></div><div>Mikolaj</div>
</blockquote></div><br></div>