matlab 复制图片到另一个文件夹 并且重命名

function rename_ETH_picture_output()
% rename the pictures in seq01/2/3-img-left to output file.
%change the name 'image_00000001_0.png' to '1_image_00000001_0.png'
outpath = 'C:\Users\hp\Desktop\DATA\data\ETH\output\';
mkdir(outpath);
a = 1:1:3;
num = length(a); 
disp('Begin to rename..')
for i = 1:num
 oringalPath = ['C:\Users\hp\Desktop\DATA\data\ETH\seq0',num2str(a(i)),'-img-left'];
 str = dir(oringalPath);
 
 for j = 3:numel(str)
    strline = str(j).name;
    Name = [num2str(a(i)),'_',strline];
    out = [outpath,Name];
    disp(out)  
    copyfile([oringalPath,'\',str(j).name],out);
 end
 
end
disp('end~~~')
end


你可能感兴趣的:(matlab)