zoukankan      html  css  js  c++  java
  • Matlab 读取父文件下子文件夹内容

     1 function ResizeImageofData
     2 % 读取文件夹下的所有数据
     3 Files = dir('D:\1\');  %父文件夹
     4 LengthFiles = length(Files);
     5 oldFolder = cd; %打开当前工作目录
     6 spath=strcat(oldFolder,'\Data\');  % 在工程目录下创建名为'\Data\'的新文件夹
     7 
     8 if ~exist(spath,'dir')
     9     mkdir(spath)
    10 end
    11 
    12 for i = 3:LengthFiles
    13     ChildFile = dir(strcat('D:\1\',Files(i,1).name,'\*.*'));
    14     N = length(ChildFile);
    15     for j = 3:1:N
    16         Img = imread(strcat('D:\1\',Files(i,1).name,'\',ChildFile(j).name));
    17         if ndims(Img)>2
    18             if ndims(Img)==3
    19                 Img=rgb2gray(uint8(Img));
    20             else
    21                 return;
    22             end
    23         end
    24         Img= imresize(Img,[800,600]);
    25         imwrite(Img, strcat(spath,Files(i).name,'_', ChildFile(j).name));
    26     end
    27 end
  • 相关阅读:
    序列化
    cookie 和 session
    a 标签提交表单
    SpringBoot使用Easypoi导出excel示例
    PDF操作类库 iText
    HandlerInterceptor
    Fastdfs
    InitializingBean
    CORS CorsFilter
    XMLHttpRequest
  • 原文地址:https://www.cnblogs.com/CBDoctor/p/3056283.html
Copyright © 2011-2022 走看看