Mercurial > hg > dcase2013_ed_vuegenetal
diff functions/challange/loadEventsList.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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/functions/challange/loadEventsList.m Fri Oct 11 12:02:43 2013 +0100 @@ -0,0 +1,27 @@ +function [onset,offset,classNames] = loadEventsList(filename) + +% Open raw file +fid = fopen(filename,'r+'); + +% Read 1st line +tline = fgetl(fid); +onset_offset(:,1) = sscanf(tline, '%f\t%f\t%*s'); +classNames{1} = char(sscanf(tline, '%*f\t%*f\t%s')'); + +% Read rest of the lines +i=1; +while ischar(tline) + i = i+1; + tline = fgetl(fid); + if (ischar(tline)) + onset_offset(:,i) = sscanf(tline, '%f\t%f\t%*s'); + classNames{i} = char(sscanf(tline, '%*f\t%*f\t%s')'); + end; +end + +% Split onset_offset +onset = onset_offset(1,:)'; +offset = onset_offset(2,:)'; + +% Close file +fclose(fid); \ No newline at end of file