Need Help Compressing/ Simplifying this Code
Mostrar comentarios más antiguos

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?
Respuestas (1)
Mathieu NOE
el 6 de Oct. de 2020
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 comentarios
luke bender
el 6 de Oct. de 2020
Mathieu NOE
el 7 de Oct. de 2020
hello
yes , yu can put your image processing in the main loop - should work fine
all the best
Categorías
Más información sobre Image Arithmetic en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!