MATLAB: Montage and imread help

Image Processing Toolboximreadmontage

Hey,
I'm trying to get my program to upload saved images from my computer to the matlab workspace and to then montage these images. I'm struggling because the examples I've seen all have specific names or folder locations where as the project I'm working on these could be anything.
Images are saved in a 1×4 cell at the moment which is the problem. Ideally I'd have them all saved under different names, e.g. Photo1, Photo2 etc in the workspace.
Any suggestions?
Cheers

Best Answer

montage can take an image array, but the images have to be in a normal numerical array, not a cell array, as described in the help:
montage(I) displays all the frames of a multiframe image array I in a single image object. I can be a sequence of binary, grayscale, or truecolor images. A binary or grayscale image sequence must be an M-by-N-by-1-by-K array. A truecolor image sequence must be an M-by-N-by-3-by-K array.
You should also use fullfile() to create the filenames and exist(name, 'file') to check that they actually exist. Why not write robust code instead of fragile code?