matlab中fullfile函数指定路径和 文件名的使用方法如下:
一点小技巧:当返回了一个文件的时候,可以用fullfile将路径和文件名组合起来,如
[filename, pathname] = uigetfile('*.m', 'Pick an M-file');
if isequal(filename,0)
disp('User selected Cancel')
else
disp(['User selected', fullfile(pathname, filename)])
end
fullfile的用法如下
f = fullfile('C:', 'Applications', 'matlab', 'myfun.m')
f = C:\Applications\matlab\myfun.m