matlab下创建带变量的文件夹

只需要将变量转换成String类型即可,matlab代码如下:


for picNum = 0:193

  if picNum<10
     fileName0 = ['00000', num2str(picNum), '_10_n', '.png' ];
     fileName1 = ['00000', num2str(picNum), '_11_n', '.png' ];
  elseif picNum<100
     fileName0 = ['0000', num2str(picNum), '_10_n',  '.png' ];
     fileName1 = ['0000', num2str(picNum), '_11_n',  '.png' ];
  else
     fileName0 = ['000',  num2str(picNum), '_10_n',  '.png' ];
     fileName1 = ['000',  num2str(picNum), '_11_n',  '.png' ];
  end
  
  % from Num 2 String.
  dirName = num2str(picNum);
  mkdir (dirName);
  
end


你可能感兴趣的:(Matlab)