matlab判断文件、文件夹是否存在

可以使用exist函数

判断文件夹是否存在,不存在则创建

if ~exist('路径','dir')
mkdir('路径');
end


判断文件是否存在

if ~exist('startup.m','file')
error(display('no startup.m file'));
end

原文地址:https://www.cnblogs.com/yibeimingyue/p/14766070.html