Please help me with this .tif to .mat file conversion

16 views (last 30 days)
pic1 = imread('IMG_1.tif');
pic2 = imread('IMG_2.tif');
pic3 = imread('IMG_3.tif');
pic4 = imread('IMG_4.tif');
pic5 = imread('IMG_5.tif');
save('MultiUAV1.mat', 'pic1', 'pic2', 'pic3', 'pic4', 'pic5');
I am trying to convert these .tif images(960 x 1280 uint16) into a single .mat file(960 x 1280 x 5 uint16), instead it is creating separate files(960 x 1280 unit6) into mutliple.
Please help me getting single .mat file(960 x 1280 x 5 uint16)
Thank you in advance!

Accepted Answer

KSSV
KSSV on 28 Nov 2017
Edited: KSSV on 28 Nov 2017
images = {'IMG_1.tif','IMG_2.tif','IMG_3.tif','IMG_4.tif','IMG_5.tif'} ;
N = length(images) ;
I = zeros(960,1280,N) ;
for i = 1:N
I1 = imread(images{i}) ;
I(:,:,i) = I1 ;
end
save MultiUAV1.mat I ;

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!