extract name from file name

1 次查看(过去 30 天)
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?

采纳的回答

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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Data Import and Analysis 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by