"Zachary " <firstname.lastname@example.org> wrote in message <email@example.com>... > Hi > > I am struggling with a simple code where I want to index all of the images I am importing from the directory so that I can manipulate each image individually. I read that MATLAB imread stores the image in an array; however, I am struggling with accessing the images. I have tried using both cat() and cell() with no luck. I am using the same code as in the FAQ to bring the pictures into MATLAB. How can I access each image from imageArray? Note: I have tried using imshow(imageArray(2)), but it gives me the same image as imshow(imageArray(1)) > > Link to FAQ: http://matlab.wikia.com/wiki/FAQ#How_can_I_process_a_sequence_of_files.3F > > Thanks > Z In that FAQ, the images are being read in one at a time, and not stored as a multidimensional array. imageArray is overwritten every time the loop is run. To access a specific image you need to run all the code in that loop, including setting jpegFiles(k).name, where k = the index of the image you want to access.
If you want to store all the images, you will probably want to use a structure (i.e. images(k).image = imread(fullFileName); ). If you can guarantee all the images have the same dimensions, then an array would work also.