mathieu@14: function [onset,offset,classNames] = loadEventsList(filename) mathieu@14: mathieu@14: % This program was written by Mathias Rossignol & Grégoire Lafay mathieu@14: % is Copyright (C) 2015 IRCAM mathieu@14: % mathieu@14: % This program is free software: you can redistribute it and/or modify it mathieu@14: % under the terms of the GNU General Public License as published by the Free mathieu@14: % Software Foundation, either version 3 of the License, or (at your option) mathieu@14: % any later version. mathieu@14: % mathieu@14: % This program is distributed in the hope that it will be useful, but mathieu@14: % WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY mathieu@14: % or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License mathieu@14: % for more details. mathieu@14: % mathieu@14: % You should have received a copy of the GNU General Public License along mathieu@14: % with this program. If not, see . mathieu@14: mathieu@14: % Open raw file mathieu@14: fid = fopen(filename,'r+'); mathieu@14: mathieu@14: % Read 1st line mathieu@14: tline = fgetl(fid); mathieu@14: onset_offset(:,1) = sscanf(tline, '%f\t%f\t%*s'); mathieu@14: classNames{1} = char(sscanf(tline, '%*f\t%*f\t%s')'); mathieu@14: mathieu@14: % Read rest of the lines mathieu@14: i=1; mathieu@14: while ischar(tline) mathieu@14: i = i+1; mathieu@14: tline = fgetl(fid); mathieu@14: if (ischar(tline)) mathieu@14: onset_offset(:,i) = sscanf(tline, '%f\t%f\t%*s'); mathieu@14: classNames{i} = char(sscanf(tline, '%*f\t%*f\t%s')'); mathieu@14: end; mathieu@14: end mathieu@14: mathieu@14: % Split onset_offset mathieu@14: onset = onset_offset(1,:)'; mathieu@14: offset = onset_offset(2,:)'; mathieu@14: mathieu@14: % Close file mathieu@14: fclose(fid);