How can I process all the files with \".xyz\" extension in a folder? The basic idea is that I want a list of file names and then a for loop to load each file.
Here is my answer:
dirName = 'E:\My Matlab\5';
[sub,fls] = subdir(dirName);
D = [];
j = 1;
for i=1:length(sub),
files{i} = dir( fullfile(sub{i},'*.xyz') );
if length(files{i})==1
D(j) = i;
files_s{j} = sub{i};
j=j+1;
end
end
varaible files_s returns the desire paths that contain those specific data types!
The subdir function can be found at: http://www.mathworks.com/matlabcentral/fileexchange/1492-subdir--new-