Need Help Compressing/ Simplifying this Code
显示 更早的评论

Basically instead of loading and referencing each image seperately is it possible(i know it is just not how ) to call all these images at once into the directory for reference theres 3 sets of images Im trying to load in each set consists of 10 images with the same name-0001(a number reference for each image in the set) I really dont want 30 lines of code just to read all these images Im assuming a for loop would be my best friend here?
回答(1 个)
Mathieu NOE
2020-10-6
hello
try this code :
% select appropriate options below ...
% files = dir('*.tif'); % all tif files in current directory
files = dir('handheld*.tif'); % as example : only tif files with "handheld" in the filename
% main loop
for ck = 1:length(files)
Filename = files(ck).name;
H{ck} = imread(Filename);
end
%%%%%%%%%%%%%%%%%%
% check if ok
%%%%%%%%%%%%%%%%%%
for ck = 1:length(files)
figure(ck), imagesc(H{ck});
end
% it works !!
2 个评论
luke bender
2020-10-6
Mathieu NOE
2020-10-7
hello
yes , yu can put your image processing in the main loop - should work fine
all the best
类别
在 帮助中心 和 File Exchange 中查找有关 Image Arithmetic 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!