How can i import multiple fits images

3 views (last 30 days)
Pruthvi Acharya
Pruthvi Acharya on 12 Dec 2018
Commented: assia assia on 30 Jun 2021
I have abou 900 fits images where i want to import them indivudually and store each image as part of a bigger matrix. So for example A = (image 1),(image 2)....
each image itself is 1023x1536.
FolderL = cd('C:\Users\pruth\Desktop\3070\LightsBadOut')
LDir = dir('*.fits');
for i =1:2
LightsC = fitsread(LDir(i).name)
i = i +1;
end
This code seems to only show me the values for when i = 2.

Answers (1)

Mark Sherstan
Mark Sherstan on 13 Dec 2018
Edited: Mark Sherstan on 13 Dec 2018
Try the following. If it doesent work please provide 2-3 of your images so we arent 100% blind trying to help you.
% Read in all images from a folder called 'images'
imgFolder = fullfile('images');
imgs = imageDatastore(imgFolder);
numOfImgs = length(imgs.Files);
for ii = 1:numOfImgs
LightsC{ii} = fitsread(imgs.Files{ii});
end

Community Treasure Hunt

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

Start Hunting!