clear clc close all for i=1:49 extension='.tif'; image1='V1_'; image2='V2_'; image3='V3_'; set=num2str(i); V1=imread([image1 set extension]); V2=imread([image2 set extension]); V3=imread([image3 set extension]); OG=sqrt(double(V1).^2+double(V2).^2+double(V3).^2 ); OGstr='OG_'; imwrite(uint16(OG),[OGstr set extension],'tif') end % OG_1=OG(:,:,1); % OG_2=OG(:,:,2); % OG_3=OG(:,:,3); % OG_4=OG(:,:,4); % OG_5=OG(:,:,5); % OG_6=OG(:,:,6); % OG_7=OG(:,:,7); % OG_8=OG(:,:,8); % OG_9=OG(:,:,9); % % imwrite(uint16(OG_1),'OG_1.tif','tif'); % imwrite(uint16(OG_2),'OG_2.tif','tif'); % imwrite(uint16(OG_3),'OG_3.tif','tif'); % imwrite(uint16(OG_4),'OG_4.tif','tif'); % imwrite(uint16(OG_5),'OG_5.tif','tif'); % imwrite(uint16(OG_6),'OG_6.tif','tif'); % imwrite(uint16(OG_7),'OG_7.tif','tif'); % imwrite(uint16(OG_8),'OG_8.tif','tif'); % imwrite(uint16(OG_9),'OG_9.tif','tif');