Matlab实用函数

本文深入解析了不同平台下文件路径的构建方式与文件名拼接规则,包括如何使用filesep函数获取特定平台的文件分隔符,并通过fullfile函数从目录名和文件名构建完整路径。以Windows系统为例,展示了如何利用这些函数构建复杂路径,确保跨平台兼容性和代码的可移植性。
 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 =
\
2:  fullfile
    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
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值