How to find specific files using dir?

8 visualizaciones (últimos 30 días)
Joshua
Joshua el 2 de Jul. de 2013
How can I use the dir command to look for files with certain parts? For example if I wanted all files in a directory that had 'random' in their names, how would I go about selecting only those files?
I know you can use the wildcard to look for certain strings, but is it possible to do it with variables? If name = random, then how would I look for files with 'random' in their names using just name?
Thanks

Respuesta aceptada

the cyclist
the cyclist el 2 de Jul. de 2013
name = 'random';
dir(['*',name,'*'])

Más respuestas (0)

Categorías

Más información sobre File Operations en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by