find a digit in string

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....

 Respuesta aceptada

Matt J
Matt J el 28 de Dic. de 2012

1 voto

name=['image' num2str(variable) '.jpg'],

Más respuestas (1)

Azzi Abdelmalek
Azzi Abdelmalek el 28 de Dic. de 2012

1 voto

variable=2
file=sprintf('image%d',variable)

Categorías

Más información sobre Convert Image Type en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 28 de Dic. de 2012

Community Treasure Hunt

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

Start Hunting!

Translated by