Mercurial > hg > dcase2013_ed_vuegenetal
annotate functions/challange/convertEventListToEventRoll.m @ 0:2fadb31a9d55 tip
Import code by Vuegen et al
author | Dan Stowell <dan.stowell@elec.qmul.ac.uk> |
---|---|
date | Fri, 11 Oct 2013 12:02:43 +0100 |
parents | |
children |
rev | line source |
---|---|
dan@0 | 1 function [eventRoll] = convertEventListToEventRoll(onset,offset,classNames) |
dan@0 | 2 |
dan@0 | 3 |
dan@0 | 4 % Initialize |
dan@0 | 5 eventRoll = zeros(ceil(offset(length(offset))*100),16); |
dan@0 | 6 eventID = {'alert','clearthroat','cough','doorslam','drawer','keyboard','keys',... |
dan@0 | 7 'doorknock','laughter','mouse','pageturn','pendrop','phone','printer','speech','switch'}; |
dan@0 | 8 |
dan@0 | 9 |
dan@0 | 10 % Fill-in eventRoll |
dan@0 | 11 for i=1:length(onset) |
dan@0 | 12 |
dan@0 | 13 pos = strmatch(classNames{i}, eventID); |
dan@0 | 14 |
dan@0 | 15 eventRoll(floor(onset(i)*100):ceil(offset(i)*100),pos) = 1; |
dan@0 | 16 |
dan@0 | 17 end; |