How to read multiple images without renaming images like 10_left.jpeg, 13_left.jpeg, 15_left.jpeg

2 views (last 30 days)
If I have multiple images in a folder e.g 10_left.jpeg, 13_left.jpeg, 15_left.jpeg, 16_left.jpeg & i want to read images in matlab one by one without renaming these images. how can I do it?

Accepted Answer

Salaheddin Hosseinzadeh
Salaheddin Hosseinzadeh on 2 Jun 2015
Edited: Salaheddin Hosseinzadeh on 3 Jun 2015
Hi Hassan,
Obviously your files names have a pattern.
You can make a for loop and create the file names
for i = 10:15
fileName = ['C:\myFolder\myPics\',num2str(i),'_left.jpg'];
image = imread(fileName); % Have a look at Image Analyst comment
disp('file doesn't exist');
This is the basic idea, you can make it better and more specific.
Good luck!

Sign in to comment.

More Answers (1)

Image Analyst
Image Analyst on 2 Jun 2015
Be sure to check out the answer to this and many other question in our FAQ:

Community Treasure Hunt

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

Start Hunting!