comparison nonExposed/getEbrs.m @ 14:b1901e8d8f5f

initial commit
author Mathieu Lagrange <mathieu.lagrange@cnrs.fr>
date Tue, 17 Mar 2015 09:34:13 +0100
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 14:b1901e8d8f5f
1 function [EBRs] = getEbrs(bgLocation,signal,sr,onset,offset)
2
3 % This program was written by Mathias Rossignol & Grégoire Lafay
4 % is Copyright (C) 2015 IRCAM <http://www.ircam.fr>
5 %
6 % This program is free software: you can redistribute it and/or modify it
7 % under the terms of the GNU General Public License as published by the Free
8 % Software Foundation, either version 3 of the License, or (at your option)
9 % any later version.
10 %
11 % This program is distributed in the hope that it will be useful, but
12 % WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 % or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 % for more details.
15 %
16 % You should have received a copy of the GNU General Public License along
17 % with this program. If not, see <http://www.gnu.org/licenses/>.
18
19 EBRs=zeros(length(onset),1);
20
21 %% get EBR of all the events of a class
22 for ii=1:length(onset)
23 eventLocation=zeros(1,length(signal));
24 eventLocation(round(onset(ii)*sr+1):round(offset(ii)*sr))=1;
25 eventLocation=logical(eventLocation);
26 EBRs(ii) = ebr(signal(eventLocation),signal(bgLocation),1,1);
27 end
28
29 end
30