📄 existfile.m
字号:
function res = existfile(fileName)
%EXISTFILE Check for file existence.
% RES = EXISTFILE(FILENAME) returns true if the file FILENAME is existing
% on the current path and false otherwise. It works similar to
% EXIST(FILENAME, 'file'), except that it does not find files on the
% Matlab path!
%
% The function is realized as a mex function (existfile.c). To compile
% the mex-function, move to the directory where file existfile.c is
% located and type
%
% mex existfile.c
%
% If this is the first time you run function MEX on your system, you
% might have to select a compiler by typing
%
% mex -setup
%
% If the mex-file (e.g. existfile.mexw32 or existfile.mexglx) is not
% existing, a (very slow) MATLAB realization is called instead.
%
% Example:
% existfile('test.txt');
%
% Markus Buehren
% Last modified 03.02.2008
%
% See also EXIST.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% persistent warnmex
% if isempty(warnmex)
% disp(sprintf('This is the m-file %s.m, not the mex-file! Type "mex existfile.c" to compile.', mfilename));
% warnmex = 1;
% end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% check input arguments
res = exist(fileName, 'file') ~= 0;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -