The dir() function expects a character array as input and a struct containing information of the files in that directory (or an empty struct if it is not a correct file path). Your error comes from the fact that DBImages is not declared yet when you call the function and without quotation marks MATLAB thinks you are referring to a variable or a function when using text.
So the short answer would be you need to use quotation marks:
ImageFiles = dir('DBImages');
This however assumes you are in the parent directory of a folder called DBImages. And the structure will contain all possible files inside this folder.
Another approach is using a full file path and adding the extension like this
ImageFiles = dir(fullfile('YourFilePath','*.png'));
With YourFilePath being the full file path to the directory containing the PNG images. The '*.png' will filter out everything that does not end with .png. The output struct will contain folder, name, ...etc. for each file. You can then use use it like this:
for ii = 1:numel(ImageFiles)