Commit 6dedaaf1 authored by James Desjardins's avatar James Desjardins
Browse files

add optional 'values' input to padflags.m

parent 4c9eb300
function flags=padflags(EEG,flags,npad)
function flags=padflags(EEG,flags,npad,varargin)
g=struct(varargin{:});
try g.value; catch, g.value=1; end;
for np=1:npad;
for i=1:size(flags,3)-1;
%forward...
if any(flags(:,:,i+1))==1
flags(:,:,i)=1;
if any(flags(:,:,i+1)) && ~any(flags(:,:,i))
flags(:,:,i)=g.value;
end
%backward...
if any(flags(:,:,(EEG.trials-(i-1))-1))==1
flags(:,:,EEG.trials-(i-1))=1;
if any(flags(:,:,(EEG.trials-(i-1))-1)) && ~any(flags(:,:,EEG.trials-(i-1)))
flags(:,:,EEG.trials-(i-1))=g.value;
end
end
end
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment