Select folders case-insensitive
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Sergio Grueso Saez
am 3 Dez. 2021
Kommentiert: Sergio Grueso Saez
am 3 Dez. 2021
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.
0 Kommentare
Akzeptierte Antwort
Image Analyst
am 3 Dez. 2021
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.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Startup and Shutdown finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!