Skip to content

Commit 1c4f02a

Browse files
ENH - use two input arguments for exist() function, see http://bugzilla.fieldtriptoolbox.org/show_bug.cgi?id=3100
1 parent d0d1aad commit 1c4f02a

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

peer/peerslave.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ function peerslave(varargin)
8282
refusegroup = ft_getopt(varargin, 'refusegroup', {});
8383
refusehost = ft_getopt(varargin, 'refusehost', {});
8484

85-
if ~isempty(threads) && exist('maxNumCompThreads')
85+
if ~isempty(threads) && exist('maxNumCompThreads', 'file')
8686
% this function is only available from MATLAB version 7.5 (R2007b) upward
8787
% and has become deprecated in MATLAB version 7.9 (R2009b)
8888
ws = warning('off', 'MATLAB:maxNumCompThreads:Deprecated');

preproc/ft_preproc_medianfilter.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
pad = ceil(order/2);
4242
dat = ft_preproc_padding(dat, 'localmean', pad);
4343

44-
hasfast = exist('fastmedfilt1d');
44+
hasfast = exist('fastmedfilt1d', 'file');
4545
if hasfast == 2 || hasfast == 3
4646
% use fast median filter mex file
4747
for k = 1:size(dat,1)

private/statistics_wrapper.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
cfg.avgoverroi = ft_getopt(cfg, 'avgoverroi', 'no');
6868

6969
% determine the type of the input and hence the output data
70-
if ~exist('OCTAVE_VERSION')
70+
if ~exist('OCTAVE_VERSION', 'builtin')
7171
[s, i] = dbstack;
7272
if length(s)>1
7373
[caller_path, caller_name, caller_ext] = fileparts(s(2).name);
@@ -280,7 +280,7 @@
280280
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
281281

282282
% determine the function handle to the intermediate-level statistics function
283-
if exist(['ft_statistics_' cfg.method])
283+
if exist(['ft_statistics_' cfg.method], 'file')
284284
statmethod = str2func(['ft_statistics_' cfg.method]);
285285
else
286286
error(sprintf('could not find the corresponding function for cfg.method="%s"\n', cfg.method));

utilities/hasyokogawa.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@
4747
% other names. At the time of writing this, the new implementation is
4848
% version 1.4.
4949

50-
if exist('getYkgwVersion')
50+
if exist('getYkgwVersion', 'file')
5151
res = getYkgwVersion();
5252
version = res.version;
5353

54-
elseif exist('GetMeg160ADbitInfoM') || exist('GetMeg160ChannelInfoM') || exist('GetMeg160ContinuousRawDataM')
54+
elseif exist('GetMeg160ADbitInfoM', 'file') || exist('GetMeg160ChannelInfoM', 'file') || exist('GetMeg160ContinuousRawDataM', 'file')
5555
% start with unknown, try to refine the version
5656
version = 'unknown';
5757

@@ -80,7 +80,7 @@
8080
m = lasterror;
8181
m.identifier;
8282
if strcmp(m.identifier, 'MATLAB:UndefinedFunction') || strcmp(m.identifier, 'MATLAB:FileIO:InvalidFid')
83-
if (exist('GetMeg160ChannelInfoM') && exist('GetMeg160ContinuousRawDataM'));
83+
if (exist('GetMeg160ChannelInfoM', 'file') && exist('GetMeg160ContinuousRawDataM', 'file'));
8484
version = '12bitBeta3';
8585
end
8686
end

0 commit comments

Comments
 (0)