Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.



Renaming files based on spreadsheet
Posted:
Jul 5, 2014 8:05 AM


Hello,
I'm trying to rename a batch of files within MATLAB using codes from an external spreadsheet (on mac). Here is a sample of the spreadsheet including codes:
Base L1 C3 C2 C3 Base C2 L1
And this is a sample list of files:
PWSM10A_2014_05_23_112132_001_Odau_1.wav PWSM10A_2014_05_23_112132_002_Odau_1.wav PWSM10A_2014_05_23_112132_003_Odau_1.wav PWSM10A_2014_05_23_112132_004_Odau_1.wav PWSM10A_2014_05_23_112132_005_Odau_1.wav PWSM10A_2014_05_23_112132_006_Odau_1.wav PWSM10A_2014_05_23_112132_007_Odau_1.wav PWSM10A_2014_05_23_112132_008_Odau_1.wav
Both lists will always be in the correct (corresponding) order. I want the codes to appear at the beginning of the file names, followed by "_" (e.g., "Base_PWSM10A_2014_05_23_112132_001_Odau_1.wav", "L1_PWSM10A_2014_05_23_112132_002_Odau_1.wav", and so on).
I have attempted to use csvread, textread, and textscan, together with movefile, but have not been successful. One major obstacle has been that MATLAB appears to not (easily) read strings of varying length. It may go without saying, but I am MATLAB novice. I would appreciate any help anybody is willing to offer.
Thank you!
Eric



