Q: How to get all images inside a folder with MATLAB? If I knew the extension of images (.jpg for example), then I would use the following to list all images:
images = dir([myfolder '\*.jpg']);

But what if I don't know the extension, and want it to work for a given set of extensions (let's say jpg, png and bmp). How can I do a generic function that takes a folder path as input and returns all the images with these extensions?
Thanks for any help,

A: Since dir() returns you a struct, you can just concatenate them together:
images = [dir('*.jpg'); dir('*.png'); dir('*.bmp')];

