Mercurial > hg > simscene-py
annotate nonExposed/loadEventsList.m @ 51:ebf92ed7d680 tip master
Added -fd (--full-duration) argument.
author | Emmanouil Theofanis Chourdakis <e.t.chourdakis@qmul.ac.uk> |
---|---|
date | Sun, 30 Sep 2018 13:21:49 +0100 |
parents | b1901e8d8f5f |
children |
rev | line source |
---|---|
mathieu@14 | 1 function [onset,offset,classNames] = loadEventsList(filename) |
mathieu@14 | 2 |
mathieu@14 | 3 % This program was written by Mathias Rossignol & Grégoire Lafay |
mathieu@14 | 4 % is Copyright (C) 2015 IRCAM <http://www.ircam.fr> |
mathieu@14 | 5 % |
mathieu@14 | 6 % This program is free software: you can redistribute it and/or modify it |
mathieu@14 | 7 % under the terms of the GNU General Public License as published by the Free |
mathieu@14 | 8 % Software Foundation, either version 3 of the License, or (at your option) |
mathieu@14 | 9 % any later version. |
mathieu@14 | 10 % |
mathieu@14 | 11 % This program is distributed in the hope that it will be useful, but |
mathieu@14 | 12 % WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
mathieu@14 | 13 % or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
mathieu@14 | 14 % for more details. |
mathieu@14 | 15 % |
mathieu@14 | 16 % You should have received a copy of the GNU General Public License along |
mathieu@14 | 17 % with this program. If not, see <http://www.gnu.org/licenses/>. |
mathieu@14 | 18 |
mathieu@14 | 19 % Open raw file |
mathieu@14 | 20 fid = fopen(filename,'r+'); |
mathieu@14 | 21 |
mathieu@14 | 22 % Read 1st line |
mathieu@14 | 23 tline = fgetl(fid); |
mathieu@14 | 24 onset_offset(:,1) = sscanf(tline, '%f\t%f\t%*s'); |
mathieu@14 | 25 classNames{1} = char(sscanf(tline, '%*f\t%*f\t%s')'); |
mathieu@14 | 26 |
mathieu@14 | 27 % Read rest of the lines |
mathieu@14 | 28 i=1; |
mathieu@14 | 29 while ischar(tline) |
mathieu@14 | 30 i = i+1; |
mathieu@14 | 31 tline = fgetl(fid); |
mathieu@14 | 32 if (ischar(tline)) |
mathieu@14 | 33 onset_offset(:,i) = sscanf(tline, '%f\t%f\t%*s'); |
mathieu@14 | 34 classNames{i} = char(sscanf(tline, '%*f\t%*f\t%s')'); |
mathieu@14 | 35 end; |
mathieu@14 | 36 end |
mathieu@14 | 37 |
mathieu@14 | 38 % Split onset_offset |
mathieu@14 | 39 onset = onset_offset(1,:)'; |
mathieu@14 | 40 offset = onset_offset(2,:)'; |
mathieu@14 | 41 |
mathieu@14 | 42 % Close file |
mathieu@14 | 43 fclose(fid); |