MATLAB Answers

0

extract name from file name

Asked by joo tan on 30 Nov 2011
dear all,
i have file which name 200101010000-200101020000.dat..but i need to rename new file using 8 first digit (like 20010101.dat)..how i can extract the name and rename my new file?

  0 Comments

Sign in to comment.

1 Answer

Answer by Walter Roberson
on 30 Nov 2011
 Accepted Answer

curname = '200101010000-200101020000.dat';
newname = curname([1:8 end-3:end]);
movefile(curname, newname);

  0 Comments

Sign in to comment.