comparison 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
comparison
equal deleted inserted replaced
-1:000000000000 0:2fadb31a9d55
1 function [onset,offset,classNames] = loadEventsList(filename)
2
3 % Open raw file
4 fid = fopen(filename,'r+');
5
6 % Read 1st line
7 tline = fgetl(fid);
8 onset_offset(:,1) = sscanf(tline, '%f\t%f\t%*s');
9 classNames{1} = char(sscanf(tline, '%*f\t%*f\t%s')');
10
11 % Read rest of the lines
12 i=1;
13 while ischar(tline)
14 i = i+1;
15 tline = fgetl(fid);
16 if (ischar(tline))
17 onset_offset(:,i) = sscanf(tline, '%f\t%f\t%*s');
18 classNames{i} = char(sscanf(tline, '%*f\t%*f\t%s')');
19 end;
20 end
21
22 % Split onset_offset
23 onset = onset_offset(1,:)';
24 offset = onset_offset(2,:)';
25
26 % Close file
27 fclose(fid);