Talk:FAQ/@comment-14.139.114.53-20150115111207

I have a folder containing 100 image files(tif). I have to display 8 image files in two seprate window, each containg 4 images files out of these 100. These 8 images should be selected like 1st,16th,32nd,48th,64th,80th... like this. I had already tried a code but it is selecting randomly images instead of specific that i wish to display. Here is the code :

myFolder = '/home/anand/Desktop/13 Jan'; if ~isdir(myFolder) errorMessage = sprintf('Error: The following folder does not exist:\n%s', myFolder); uiwait(warndlg(errorMessage)); return; end filePattern = fullfile(myFolder, '*.tif'); jpegFiles = dir(filePattern); m=length(jpegFiles); fprintf('no of images=%d\n ',m); n=m/4; y=1; for k = 1:n baseFileName = jpegFiles(k).name; fullFileName = fullfile(myFolder, baseFileName); fprintf(1, 'Now reading %s\n', fullFileName); imageArray = imread(fullFileName); subplot(2,2,y),imshow(imageArray); title(baseFileName); y=y+1; imshow(imageArray);  % Display image. drawnow; % Force display to update immediately. end