Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Batch renaming based on .csv/.xls
Replies: 6   Last Post: Jul 8, 2014 11:57 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Eric Jackson

Posts: 4
Registered: 7/5/14
Batch renaming based on .csv/.xls
Posted: Jul 7, 2014 3:45 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

I'm trying to rename a batch of files within MATLAB using codes from an external spreadsheet. I'm using a Mac. Here is a sample from the spreadsheet that includes the codes I need:

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 been unsuccessful. 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



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.