1 : filesep
Directory separator for this platform.
F = filesep returns the file separator character for this platform.
The file separator is the character that separates
directory names in filenames.
Example(windows):
filesep
ans =
\
fullfile(D1,D2, ... ,FILE) builds a full file name from the directories D1,D2, etc and filename FILE specified. This is conceptually equivalent to
F = [D1 filesep D2 filesep ... filesep FILE]
except that care is taken to handle the cases where the directory
parts D1, D2, etc. may begin or end in a filesep. Specify FILE = ''
to build a pathname from parts.
Example(windows):
fullfile(matlabroot,'toolbox','matlab','general','Contents.m')
ans =
C:\Program Files\MATLAB\R2011b\toolbox\matlab\general\Contents.m
本文深入解析了不同平台下文件路径的构建方式与文件名拼接规则,包括如何使用filesep函数获取特定平台的文件分隔符,并通过fullfile函数从目录名和文件名构建完整路径。以Windows系统为例,展示了如何利用这些函数构建复杂路径,确保跨平台兼容性和代码的可移植性。
4341

被折叠的 条评论
为什么被折叠?



