Renaming files in a folder in bulk
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
BobbyRoberts
le 22 Juil 2020
Commenté : BobbyRoberts
le 22 Juil 2020
Hi. I am trying to rename a bunch of MAT files within a folder.
For example, the current files are named: AB007_group2_subject011_naive_day2_rawdata.mat
Each file varies on the numbers after "subject", "group, and "day".
I would like to change all of the files to be in the following format: AB007_subject011_day2_rawdata.mat
So essentially, I just want to delete the group and naive portion of the filename.
Thanks a lot!
0 commentaires
Réponse acceptée
Fangjun Jiang
le 22 Juil 2020
Modifié(e) : Fangjun Jiang
le 22 Juil 2020
>> name='AB007_group2_subject011_naive_day2_rawdata.mat'
name =
'AB007_group2_subject011_naive_day2_rawdata.mat'
>> name=regexprep(name,'_group\d+','')
name =
'AB007_subject011_naive_day2_rawdata.mat'
>> name=regexprep(name,'_naive','')
name =
'AB007_subject011_day2_rawdata.mat'
3 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur File Operations dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!