comparison nonExposed/getEventsLocation.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 [ eventsLocation ] = getEventsLocation(signalLength,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 %% events location: LOGICAL
20 % 1 : Events
21 % 0 : BG
22
23 %% Init events Location
24 eventsLocation=zeros(1,signalLength);
25
26 for ii=1:length(onset)
27 eventsLocation(round(onset(ii)*sr+1):round(offset(ii)*sr))=1;
28 end
29
30 %% Logical conversion
31 eventsLocation=logical(eventsLocation);
32 end
33