MATLAB: How can I display one of the images instead of displaying all? can anybody help me please

ccImage Processing Toolbox

i am trying to read images from a folder and display one of them.
image_folder= 'C:\Octave\Octave-4.2.1\share\octave\packages\images' filename=dir(fullfile(image_folder,'*.jpg')); total_images=numel(filename);
for n=1:total_images f=fullfile(image_folder,filename(n).name); our_images=imread(f)
figure(n)
imshow(our_images)
end

Best Answer

Well you've created a for-loop, so it shows all of the images in those figures. If you only want to display 1 specific image, you should just get rid of the loop and specify wich image you want to display.
image_folder= 'C:\Octave\Octave-4.2.1\share\octave\packages\images'
filename=dir(fullfile(image_folder,'*.jpg'));
n = 20; % from `filename`
f=fullfile(image_folder,filename(n).name);
my_image=imread(f);
figure();
imshow(our_images)
Related Question