matlab fullfile

 

f = fullfile(folderName1, folderName2, ..., fileName) builds a full file specification f from the folders and file name specified. Input arguments folderName1, folderName2, etc. and fileName are each strings enclosed in single quotation marks. The output of fullfile is conceptually equivalent to f = [folderName1 filesep folderName2 filesep ... filesep filename]

except that care is taken to handle the cases when the folders begin or end with a file separator.

 

 

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

posted @ 2012-08-02 20:16  小鸡蛋的理想  阅读(1604)  评论(0)    收藏  举报