-
Notifications
You must be signed in to change notification settings - Fork 1
/
pop_copyEventMarker.m
49 lines (40 loc) · 1.93 KB
/
pop_copyEventMarker.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
% pop_copyEventMarker() - Copy event markers from the current dataset to
% the selected dataset.
% Usage:
% >> [ALLEEG,EEG] = pop_copyEventMarker(ALLEEG,EEG);
% Author: Makoto Miyakoshi, JSPS/SCCN,INC,UCSD 2012-
% History:
% 12/26/2012 ver 1.0 by Makoto. Created.
% Copyright (C) 2012 Makoto Miyakoshi, JSPS/SCCN,INC,UCSD;
%
% This program is free software; you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation; either version 2 of the License, or
% (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program; if not, write to the Free Software
% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
function [ALLEEG,EEG] = pop_copyEventMarker(ALLEEG,EEG)
userInput = inputgui('title', 'pac_pop_main', 'geom', ...
{{2 1 [0 0] [1 1]} {2 1 [1 0] [1 1]}}, ...
'uilist',...
{{'style' 'text' 'string' 'Which dataset to copy current event markers?'} {'style' 'edit' 'string' ''}});
% if canceled, escape
if isempty(userInput), return, end
% decode user input
destination = str2double(userInput{1,1});
% data status check
if destination > length(ALLEEG); error('Invalid dataset index.'); end
if EEG.pnts ~= ALLEEG(1,destination).pnts; error('Data lengths are different.'); end
if EEG.srate ~= ALLEEG(1,destination).srate; error('Sampling rates are different.'); end
if size(EEG.data) ~= size(ALLEEG(1,destination).data); error('Data sizes are different.'); end
% copy event markers
ALLEEG(1,destination).event = EEG.event;
% display message
disp('Event markers copied.')