使用sprintf生成操作系统命令,然后调用dos函数执行:
cd('D:\file');for i=1:50 cmd = sprintf('ren data.%03i %03i.txt', i, i); dos(cmd);end