-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
substantial edit to epoch marking in proc_interp; minor edits to proc…
…_artifact and artifact_channels; updates on alcstress scripts
- Loading branch information
Showing
10 changed files
with
185 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
function [val, remaining] = keyval(key, varargin) | ||
|
||
% KEYVAL returns the value that corresponds to the requested key in a | ||
% key-value pair list of variable input arguments | ||
% | ||
% Use as | ||
% [val] = keyval(key, varargin) | ||
% | ||
% See also VARARGIN | ||
|
||
% Undocumented option | ||
% [val] = keyval(key, varargin, default) | ||
|
||
% Copyright (C) 2005-2007, Robert Oostenveld | ||
% | ||
% This file is part of FieldTrip, see http://www.ru.nl/neuroimaging/fieldtrip | ||
% for the documentation and details. | ||
% | ||
% FieldTrip 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 3 of the License, or | ||
% (at your option) any later version. | ||
% | ||
% FieldTrip 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 FieldTrip. If not, see <http://www.gnu.org/licenses/>. | ||
% | ||
% $Id: keyval.m 7123 2012-12-06 21:21:38Z roboos $ | ||
|
||
% what to return if the key is not found | ||
emptyval = []; | ||
|
||
if nargin==3 && iscell(varargin{1}) | ||
emptyval = varargin{2}; | ||
varargin = varargin{1}; | ||
end | ||
|
||
if nargin==2 && iscell(varargin{1}) | ||
varargin = varargin{1}; | ||
end | ||
|
||
if mod(length(varargin),2) | ||
error('optional input arguments should come in key-value pairs, i.e. there should be an even number'); | ||
end | ||
|
||
% the 1st, 3rd, etc. contain the keys, the 2nd, 4th, etc. contain the values | ||
keys = varargin(1:2:end); | ||
vals = varargin(2:2:end); | ||
|
||
% the following may be faster than cellfun(@ischar, keys) | ||
valid = false(size(keys)); | ||
for i=1:numel(keys) | ||
valid(i) = ischar(keys{i}); | ||
end | ||
|
||
if ~all(valid) | ||
error('optional input arguments should come in key-value pairs, the optional input argument %d is invalid (should be a string)', i); | ||
end | ||
|
||
hit = find(strcmpi(key, keys)); | ||
if isempty(hit) | ||
% the requested key was not found | ||
val = emptyval; | ||
elseif length(hit)==1 | ||
% the requested key was found | ||
val = vals{hit}; | ||
else | ||
error('multiple input arguments with the same name'); | ||
end | ||
|
||
if nargout>1 | ||
% return the remaining input arguments with the key-value pair removed | ||
keys(hit) = []; | ||
vals(hit) = []; | ||
remaining = cat(1, keys(:)', vals(:)'); | ||
remaining = remaining(:)'; | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters