MATLAB: Does dir(‘*.mat’) not list all of the .mat files in directory

dir

Hello,
I'm trying to create a structure file which lists all of the .mat files in my directory:
files = dir('*.mat')
This code returns a 4×1 structure, but I have 8 .mat files in the directory. All 8 of the .mat files are the same format (i.e. 3 variables per .mat file). Can anyone tell me why my other .mat files are not being listed in the struct file?
Thanks, Dan

Best Answer

Are you sure about those files being in there? Does WHAT see them (type: what) in there?
D = dir;
length(regexp([D(:).name],'\.mat')) % What does this say