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!