📄 fileparamparser.m
字号:
function ofile = fileparamparser(cc,ifile)
%FILEPARAMPARSER Private filename parsing function
% OFN=FILEPARAMPARSER(CC,IFN) parses the passed filename
% and does a search for the file in the Code Composer
% working directory and then the Matlab path.
%
% Copyright 2001-2002 The MathWorks, Inc.
% $Revision: 1.7 $ $Date: 2002/06/12 15:30:42 $
if ~ischar(ifile),
error('FILE parameter should be a char array.');
elseif isempty(ifile),
error('FILE parameter is empty.');
end
ifile = deblankall(ifile); % Remove any trailing or leading blanks
[fpath,fname,fext] = fileparts(ifile);
if isempty(fpath), % No path information at ALL, check Code Composer AND matlab path
ccspath = cc.cd;
ofile = fullfile(ccspath,ifile);
if exist(ofile,'file') ~= 2,
% Not in code composer, try Matlab path
ofile = which(ifile);
if isempty(ofile),
error('Specified file does not exist on CCS or Matlab path');
end
end
elseif ~isempty(findstr(ifile,':')) ||strcmp(ifile(1:2),'\\') || strcmp(ifile(1:2),'//'), % Windows only, Full path given?
% Networked locations
ofile = ifile;
if exist(ofile,'file') ~= 2,
error('Specified file does not exist on CCS path');
end
else % Relative path or .\, check from CCS path ONLY
ccspath = cc.cd;
ofile = fullfile(ccspath,ifile);
if exist(ofile,'file') ~= 2,
error('Specified file does not exist on CCS path');
end
end
%--------------------------------------
function str = deblankall(str)
len = length(str);
str = deblank( str(len:-1:1) );
str = deblank( str(length(str):-1:1) );
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -