view event_detection/loadEventsList.m @ 5:1f977a3aab1a

overall confusion matrix: check for rowsum equality; and format cm as rounded percentages
author Dan Stowell <dan.stowell@elec.qmul.ac.uk>
date Mon, 13 May 2013 14:42:31 +0100
parents c8924e29f1aa
children
line wrap: on
line source
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')');
    	if (classnames{i} == 'doorknock')
           classnames{i} = 'knock';
    	end; 
    end;
end

% Split onset_offset
onset = onset_offset(1,:)';
offset = onset_offset(2,:)';

% Close file
fclose(fid);