Select folders case-insensitive

4 次查看(过去 30 天)
I am doing a for loop where I enter several folders and then one of two subfolders. These subfolders are allways the same: Data and Practice. I allways need to enter the folder Data and do some analysis and I want to know how to select the folder Data everytime independently of being Data or data.
Example:
Folder1
- Data
- file.m
- Practice
Folder2
- data
- file.m
- practice
Sometimes the folder is saved as "Data" and sometimes is saved as "data". Is there a way to tell matlab to look for the folder no matter how it is written the first letter? Something intuitive but stupid will be like this:
path = fullfile(rest_of_the_path, '\*ata\', file.m)
I know it doesn't work but I just want to make it easier to understand
Thanks.

采纳的回答

Image Analyst
Image Analyst 2021-12-3
I don't believe the case of the folder name should matter as far as doing things like getting files living it it, calling mkdir(), etc.
However DO NOT use path as the name of your full file name since path is a very important built-in variable and you don't want to destroy it by overwriting it.
  1 个评论
Sergio Grueso Saez
Sergio Grueso Saez 2021-12-3
I'm sorry, you are right! I guess I had another error and thought it was because of this. Thank you!

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Startup and Shutdown 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by