concatpath.m
来自「This contribution provides functions for」· M 代码 · 共 27 行
M
27 行
function str = concatpath(varargin)
%CONCATPATH Concatenate file parts with correct file separator.
% STR = CONCATPATH(STR1, STR2, ...) concatenates file/path parts with the
% system file separator.
%
% Example:
% drive = 'C:';
% fileName = 'test.txt';
% fullFileName = concatpath(drive, 'My documents', fileName);
%
% Markus Buehren
% Last modified 05.04.2009
%
% See also FULLFILE, FILESEP, CHOMPSEP.
str = '';
for n=1:nargin
curStr = varargin{n};
str = fullfile(str, chompsep(curStr));
end
if ispc
str = strrep(str, '/', '\');
else
str = strrep(str, '\', '/');
end
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?