montage and imread help

3 views (last 30 days)
Ian
Ian on 3 Mar 2013
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 1x4 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

Accepted Answer

Image Analyst
Image Analyst on 3 Mar 2013
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?

More Answers (0)

Categories

Find more on Images in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!