Mercurial > hg > aasp-d-case-metrics
annotate event_detection/loadEventsList.m @ 10:507300d2ed66 tip
merge
author | Dan Stowell <dan.stowell@elec.qmul.ac.uk> |
---|---|
date | Thu, 10 Oct 2013 09:18:47 +0100 |
parents | c8924e29f1aa |
children |
rev | line source |
---|---|
emmanouil@0 | 1 function [onset,offset,classNames] = loadEventsList(filename) |
emmanouil@0 | 2 |
emmanouil@0 | 3 % Open raw file |
emmanouil@0 | 4 fid = fopen(filename,'r+'); |
emmanouil@0 | 5 |
emmanouil@0 | 6 % Read 1st line |
emmanouil@0 | 7 tline = fgetl(fid); |
emmanouil@0 | 8 onset_offset(:,1) = sscanf(tline, '%f\t%f\t%*s'); |
emmanouil@0 | 9 classNames{1} = char(sscanf(tline, '%*f\t%*f\t%s')'); |
emmanouil@0 | 10 |
emmanouil@0 | 11 % Read rest of the lines |
emmanouil@0 | 12 i=1; |
emmanouil@0 | 13 while ischar(tline) |
emmanouil@0 | 14 i = i+1; |
emmanouil@0 | 15 tline = fgetl(fid); |
emmanouil@0 | 16 if (ischar(tline)) |
emmanouil@0 | 17 onset_offset(:,i) = sscanf(tline, '%f\t%f\t%*s'); |
emmanouil@0 | 18 classNames{i} = char(sscanf(tline, '%*f\t%*f\t%s')'); |
emmanouil@1 | 19 if (classnames{i} == 'doorknock') |
emmanouil@1 | 20 classnames{i} = 'knock'; |
emmanouil@1 | 21 end; |
emmanouil@0 | 22 end; |
emmanouil@0 | 23 end |
emmanouil@0 | 24 |
emmanouil@0 | 25 % Split onset_offset |
emmanouil@0 | 26 onset = onset_offset(1,:)'; |
emmanouil@0 | 27 offset = onset_offset(2,:)'; |
emmanouil@0 | 28 |
emmanouil@0 | 29 % Close file |
emmanouil@1 | 30 fclose(fid); |