How can i import multiple fits images

조회 수: 3 (최근 30일)
Pruthvi Acharya
Pruthvi Acharya 2018년 12월 12일
댓글: assia assia 2021년 6월 30일
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.

답변 (1개)

Mark Sherstan
Mark Sherstan 2018년 12월 13일
편집: Mark Sherstan 2018년 12월 13일
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!

Translated by