How to use "dir" to find files beginning with a certain word

7 views (last 30 days)
Hi, okay so i have two variables named 'QUS_PNB.mat' and ' JMP_QUS_PNB.mat'
When i run the following:
file_name = dir('*QUS_PNB*.mat');
it gives me both of the files, but dont want to include the JMP one. how do i specify that it must start with a QUS?
Thank you so much.

Accepted Answer

Cris LaPierre
Cris LaPierre on 27 Feb 2023
Remove the first asterisk.
file_name = dir('QUS_PNB*.mat');

More Answers (0)

Categories

Find more on File Operations in Help Center and File Exchange

Tags

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!