- Please format your code in the forum using the "{} Code" button. It is a good idea to post readable code.
- An easier method to create the file pattern:
- The field .name contains the file name only, so there is no need to split it by fileparts.
- Use fullfile instead of strcat:
