Skip to content

Commit 52f1e2e

Browse files
committed
FIX - MEEG: emptymatch
1 parent 0d74784 commit 52f1e2e

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

aa_modules/aamod_meeg_epochs.m

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -466,8 +466,8 @@
466466
% data
467467
alleeg = cellfun(@(t) pop_loadset(eminfname{contains(eminfname, t)}), em{1});
468468
if numel(alleeg) ~= numel(em{1})
469-
fid = fopen(fullfile(aas_getsesspath(aap,subj,sess),'emptymatch'),'w');
470-
fprintf(fid,strjoin(em{1},' + '));
469+
fid = fopen(fullfile(aas_getsesspath(aap,subj,sess),'emptymatch'),'a');
470+
fprintf(fid,'%s\n',strjoin(em{1},' + '));
471471
fclose(fid);
472472
continue;
473473
end
@@ -494,12 +494,13 @@
494494
end
495495
end
496496
end
497-
if isempty(selEv) ||...
498-
any([alleeg.trials] == 1) % treated as continuous data by EEGLAB, which removes epochs
499-
fid = fopen(fullfile(aas_getsesspath(aap,subj,sess),'emptymatch'),'w');
500-
fprintf(fid,strjoin(em{1},' + '));
497+
isemptymatch = isempty(selEv) ||...
498+
any([alleeg.trials] == 1); % treated as continuous data by EEGLAB, which removes epochs
499+
if isemptymatch
500+
fid = fopen(fullfile(aas_getsesspath(aap,subj,sess),'emptymatch'),'a');
501+
fprintf(fid,'%s\n',strjoin(em{1},' + '));
501502
fclose(fid);
502-
continue;
503+
break;
503504
end
504505

505506
% - select event matched with all other EEGs
@@ -541,6 +542,7 @@
541542
alleeg(indeeg).epoch(indEp) = rmfield(currEp,setdiff(fieldnames(currEp),fieldnames(alleeg(indeeg).epoch)));
542543
end
543544
end
545+
if isemptymatch, continue; end
544546

545547
% save EEGs;
546548
for eeg = alleeg

0 commit comments

Comments
 (0)