Create a new test applet, the code is as follows:
folder='test/12a/'; %%定义变量
if exist(folder)==0 %%判断文件夹是否存在
mkdir(folder); %%不存在时候,创建文件夹
else
disp('dir is exist'); %%如果文件夹存在,输出:dir is exist
end
Status when not executed:
Perform the first time, there is no folder. Created at this time.
If there is a folder, execute "dir is exist".
Note: In general testing, you need to change the file directory according to your own needs.