[Eeglablist] remove entire rows from EEG.event
Andreas Widmann
widmann at uni-leipzig.de
Mon Mar 28 05:36:04 PDT 2016
> Is there a straight forward way to delete rows in a struct array with fields, depending on a particular field entry?
[ EEG.event( strcmp( 'boundary', { EEG.event.type } ) | strcmp( 'R 1', { EEG.event.type } ) ) ] = [];
> Putting a for loop around it doesn’t help much as b exceeds the new EEG.event length at some point…
EEG.event (length) must not change during the loop execution. Besides exceeding EEG.event length you will also miss successive to be removed events. For loop works if you first collect events and remove afterwards, e.g.
removeIdxArray = [];
for b = 1:length(EEG.event)
if strcmp(EEG.event(b).type, 'boundary')
removeIdxArray = [ removeIdxArray b ];
elseif strcmp(EEG.event(b).type, 'R 1')
removeIdxArray = [ removeIdxArray b ];
end
end
EEG.event( removeIdxArray ) = [];
Hope this helps! Best,
Andreas
> Am 26.03.2016 um 13:36 schrieb Clemens DICKHUT <clemens.dickhut at uni.lu>:
>
> Hi all,
>
> I’d like to remove rows in EEG.event that I don’t need.
>
> Is there a straight forward way to delete rows in a struct array with fields, depending on a particular field entry?
> I tried the following:
>
> for b = 1:length(EEG.event)
>
> if strcmp(EEG.event(b).type, 'boundary')
> EEG.event(b) = [];
> elseif strcmp(EEG.event(b).type, 'R 1')
> EEG.event(b) = [];
> end
>
> end
>
>
>
> Putting a for loop around it doesn’t help much as b exceeds the new EEG.event length at some point...
>
> Hope someone can help. Thanks a lot in advance.
>
> Best,
> Clemens
>
>
>
> __________________________________
> Clemens Dickhut, M.Sc., (PhD Student)
> Institute for Health and Behaviour
> Research Unit INSIDE
> University of Luxembourg - Campus Belval
> Maison des Sciences Humaines
> 11, Porte des Sciences, R. 04 415
> L-4366 Esch-sur-Alzette
> Tel.: (+352) 46 66 44 9536
>
>
>
> _______________________________________________
> Eeglablist page: http://sccn.ucsd.edu/eeglab/eeglabmail.html
> To unsubscribe, send an empty email to eeglablist-unsubscribe at sccn.ucsd.edu
> For digest mode, send an email with the subject "set digest mime" to eeglablist-request at sccn.ucsd.edu
More information about the eeglablist
mailing list