1. 程式人生 > >用matlab批量新建和刪除資料夾

用matlab批量新建和刪除資料夾

clear  
clc  

cd('E:\MyData2\test');%設定當前目錄:current directory   

for i = 1 : 100  
    folderName{i} = ['movie', num2str(i)];  
    mkdir(folderName{i});  % 新建一個資料夾   
end  
clear  
clc  

cd('E:\MyData2\test'); %設定當前目錄:current directory   
for i = 1 : 100  
    rmdir(['movie', num2str(i)]);  % 刪除資料夾(不經過回收站)  
end

關於擷取和重新寫入···

for i=1:500
        I0=['F:\手掌靜脈影象\data_rotate_small_resize\data_rotate_2.4_resize\',sprintf('%d',i),'_6','.bmp'];
        I1=['F:\手掌靜脈影象\data_rotate_small_resize\data_rotate_2.4_resize\',sprintf('%d',i),'_12','.bmp'];
        II0=imread(I0);%讀取原影象
        II1=imread(I1);
        WTR='E:\MyData2\test\';
        WTR6=strcat(WTR,num2str(i),'
\',num2str(i),'_','6(2.4).bmp'); WTR12=strcat(WTR,num2str(i),'\',num2str(i),'_','12(2.4).bmp'); imwrite(II0,WTR6); imwrite(II1,WTR12); end