MATLAB: Opening files with randomly varying file names

fopen

Hello,
I am using Matlab to read in csv files generated during data collection. The files all have the format:
PR-2230A_YYYY-MM-DD_00-08-*.csv
where the * is a randomly changing number from 0 to 9. There is no pattern to the number and I have A LOT of data files to open so I need to loop through them. Typically I would declare a filename and use strcat() with variables for any part of the filename that changed, but since I have no idea what the numbers will be I can't do this. The last number is non essential there is only one file per day.
Is there anyway to read in the files without knowing the last number?
i.e. filename = strcat('PR-2230A_',YYYY,'-',MM,'-',DD,'_00-08-',~,'.csv')
I would be greatful for any help!

Best Answer

I propose a different approach:
EDIT: forgot about the wildcard
% Retrieve all the files in a directory
names = dir('C:\Users\Oleg\Desktop\Nuova cartella\PR-2230A_YYYY-MM-DD_00-08-*.csv');
names = {names.name};
Now names will contain only the files which begin with root and you can loop through all of them and load one by one.
Oleg