MATLAB Answers


How to find specific files using dir?

Asked by Joshua
on 2 Jul 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?




No products are associated with this question.

1 Answer

Answer by the cyclist
on 2 Jul 2013
 Accepted answer

name = 'random';

  1 Comment

on 2 Jul 2013

Thank you so much!

Join the 15-year community celebration.

Play games and win prizes!

Learn more
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!