Clear Filters
Clear Filters

find a digit in string

2 views (last 30 days)
Elysi Cochin
Elysi Cochin on 28 Dec 2012
i have a folder named "inputImages" it contains 5 images named image1, image2 ... image5
i have a variable which contains a digit... if that digit contains in any of the names i want that image to get displayed in a figure...
example
variable=2; then image2.jpg should get displayed....
please can someone help me how to get the name of the image that contains the digit....

Accepted Answer

Matt J
Matt J on 28 Dec 2012
name=['image' num2str(variable) '.jpg'],

More Answers (1)

Azzi Abdelmalek
Azzi Abdelmalek on 28 Dec 2012
variable=2
file=sprintf('image%d',variable)

Categories

Find more on Characters and Strings in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!