Skip to content

Instantly share code, notes, and snippets.

@rysk-t
Created November 2, 2015 00:10
Show Gist options
  • Select an option

  • Save rysk-t/cdce72f1931b7eef0b39 to your computer and use it in GitHub Desktop.

Select an option

Save rysk-t/cdce72f1931b7eef0b39 to your computer and use it in GitHub Desktop.
あるフォルダ以下のサブフォルダのリストを作る => 任意の拡張子のファイルパスを取得 (ここでは*.jpg)
ldirs = genpath(pwd);
ldirs = [';' ldirs];
sepidx = strfind(ldirs, ';');
for i = 1:length(sepidx)-1
gpath{i} = ldirs(sepidx(i)+1:sepidx(i+1)-1);
end
j = 1;
for i = 1:length(gpath)
fpathcur = dir([gpath{i} '\*.mdf']);
if length(fpathcur)>0
for f =1:length(fpathcur)
mdfs.full{j} = [gpath{i} '\' fpathcur(f).name];
mdfs.file{j} = fpathcur(f).name;
j = j+1;
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment