现在的位置: 首页 > 综合 > 正文

Use matlab to traverse the files in a folder

2013年03月09日 ⁄ 综合 ⁄ 共 407字 ⁄ 字号 评论关闭

mydir=uigetdir('D:\Sequences\Weizmann\bend'); %displays a dialog box for the user to browse through the directory
%structure and select a directory, and returns the directory name as a string
if mydir(end)~='\'
mydir=[mydir,'\'];
end

DIRS=dir(['D:\Sequences\Weizmann\bend\','*.avi']); %扩展名 (method 1)
%DIRS=dir([mydir,'*.avi']); %扩展名 (method 2)
n=length(DIRS);
for i=1:n
if ~DIRS(i).isdir
DIRS(i).name %%%%%%%要载入,做处理,你在这里弄就可以了
%load(DIRS(i).name)
end
end

抱歉!评论已关闭.