【MATLAB】————拷贝指定文件路径下的有序文件(选择后),可处理固定规律的文件图片数据或者文件

本文介绍了一种数据处理思路,通过指定索引选择特定数据,并将选定数据从源文件夹复制到目标文件夹的方法。该过程涉及路径创建、文件复制等步骤,适用于需要按特定条件筛选并转移数据的场景。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

总体上来说这种数据有2中处理思路。第一种如下所示,从一组数据中挑选出符合要求的数据;

 第二中就是数据中不需要的数据删除,选择处理不需要的数据,留下的补集就是需要的数库。一般情况下需要看问题是否明确,需求明确的话,考虑操作数,和操作的复杂程度,选择具体使用哪一种数据。

index=[2,4,7,13,14];
% parent_path='\\ip\public\光学测试\0基线\O公司\O公司实测数据\拍摄';
parent_path='C:\Users\Administrator\Desktop\part_noon';
folder_name='室内人脸';

output_path=['C:\Users\Administrator\Desktop\上午\',folder_name];
if exist(output_path,'dir')
    rmdir(output_path,'s');
end

if ~exist(output_path,'dir')
    mkdir(output_path);
end

output_depth=[output_path,'\depth'];
if ~exist(output_depth,'dir')
    mkdir(output_depth);
end

output_ir=[output_path,'\ir'];
if ~exist(output_ir,'dir')
    mkdir(output_ir);
end

output_raw=[output_path,'\raw'];
if ~exist(output_raw,'dir')
    mkdir(output_raw);
end

floder_path=[parent_path,'\',folder_name];
for i = 1:size(index,2)
    filepath=[floder_path,'\raw\depth8_',num2str(index(i)),'.bmp'];
    copytopath=[output_raw,'\depth8_',num2str(i),'.bmp'];
    copyfile(filepath, copytopath);
    
    filepath=[floder_path,'\raw\ir_background8_',num2str(index(i)),'.bmp'];
    copytopath=[output_raw,'\ir_background8_',num2str(i),'.bmp'];
    copyfile(filepath, copytopath);
    
    filepath=[floder_path,'\raw\ir8_',num2str(index(i)),'.bmp'];
    copytopath=[output_raw,'\ir8_',num2str(i),'.bmp'];
    copyfile(filepath, copytopath);
    
    filepath=[floder_path,'\raw\speckle_enhance8_',num2str(index(i)),'.bmp'];
    copytopath=[output_raw,'\speckle_enhance8_',num2str(i),'.bmp'];
    copyfile(filepath, copytopath);
    
    filepath=[floder_path,'\raw\speckle_original8_',num2str(index(i)),'.bmp'];
    copytopath=[output_raw,'\speckle_original8_',num2str(i),'.bmp'];
    copyfile(filepath, copytopath);
    
    filepath=[floder_path,'\raw\speckle8_',num2str(index(i)),'.bmp'];
    copytopath=[output_raw,'\speckle8_',num2str(i),'.bmp'];
    copyfile(filepath, copytopath);
    
    %
    filepath=[floder_path,'\ir\',num2str(index(i)),'.png'];
    copytopath=[output_ir,'\',num2str(i),'.png'];
    copyfile(filepath, copytopath);
    
    %
    filepath=[floder_path,'\depth\',num2str(index(i)),'.png'];
    copytopath=[output_depth,'\',num2str(i),'.png'];
    copyfile(filepath, copytopath);
end
index
folder_name

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

大江东去浪淘尽千古风流人物

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值