Loop on loading files
显示 更早的评论
Hi!
I have a folder containing subfolders containing hdf5 files (10,000 of them in fact).
A example of a path would be 'data\A\F\G\TRATTGW128F427A82D.h5'.
Below 'data', there are 3 levels of folders, all named by a single letter. The final files all have similar names to TRATTGW128F427A82D.h5.
I have a function that converts hdf5 files to .mat. I want to upload all these files and store some of their info in a matrix.
Example:
hdf5_to_matfile('path\to\hdf5.h5','path\to\outputk.mat');
matk=load('path\to\outputk.mat');
A(k,1)=matk.data1;
A(k,2)=matk.data2;
How can I loop over all my folders and subfolder to obtain this one single matrix A containing one line for each folder with data1 and data2 in each column? And what would be the fastest way to proceed?
Thank you for your help!
采纳的回答
更多回答(1 个)
Jeff
2013-5-2
2 个评论
Jeff
2013-5-2
Walter Roberson
2013-5-2
You posted code for this somewhere along the line. Or you can look in the File Exchange for rdir or another rdir
类别
在 帮助中心 和 File Exchange 中查找有关 Search Path 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!