MATLAB: How to read in specific cells which contain file names ending in ‘Pressure.mat’

dirfilesloadmatMATLABmatrixtextscan

I have a list of 490 files in a matrix, I want to only read the files which end in 'Pressure.mat', if it does not end in this I don't want to read it. What function can I use to do this? Even creating a new matrix which only contains these specific cells containing the files would be what I need.

Best Answer

You can run a loop, and use strfind. Find for Pressure.mat in the string, if the output is not empty, then you have to read the file.