根据.mat数据挑出第一列序号的图
clc;
A = load('H:\5mm余高熔深mat\熔深电流组5mm定位\20-38.mat');
fpath = 'H:\2019-6-19熔深实验\2019-06-19熔深黑白-板厚5mm\20-38\';
name = dir(fpath);
fpath1_img = 'H:\2019-6-19熔深实验\2019-06-19熔深黑白-板厚5mm\基值\20-38\';
A_struct = struct2cell(A);
A_num = A_struct{1,1}(:,1);
%A_len = A_struct{1,1}(:,2);
%depth = A_struct{1,1}(:,3);
[a,b] = size(A_num);
cc = 1;
for id = 3:length(name)
wholename=strcat(fpath,name(id).name);
img_name = name(id).name;
img_len = length(img_name);
img_num = str2double(img_name(1:img_len-4));
for i = 1:a
A_num_int = A_num(i,:);
A_num_num = A_num(i,:);
if(img_num==(A_num_num))
img = imread(wholename);
%img = demosaic(img,'bggr');
% figure(1);imshow(img);
if( A_num_num>99&&A_num_num<1000)
filePath1 = strcat(fpath1_img,'00', num2str(A_num_num),'.bmp');
elseif(A_num_num < 100 && A_num_num>9)
filePath1 = strcat(fpath1_img,'000', num2str(A_num_num),'.bmp');
elseif(A_num_num < 10)
filePath1 = strcat(fpath1_img,'0000', num2str(A_num_num),'.bmp');
elseif(A_num_num > 999 && A_num_num<10000)
filePath1 = strcat(fpath1_img,'0', num2str(A_num_num),'.bmp');
else
filePath1 = strcat(fpath1_img, num2str(A_num_num),'.bmp');
end
wholename_test=sprintf('%s',filePath1);
imwrite(img,wholename_test);
end
end
end