フィルターのクリア

Automatically running a program for files in a folder

2 ビュー (過去 30 日間)
Venkatesh M Deshpande
Venkatesh M Deshpande 2014 年 2 月 27 日
編集済み: per isakson 2014 年 2 月 27 日
Hi, I have a folder which has 36 zip files. Each zip file ,if extracted, will have 5 files out of which one file (extension .HDF) is relevant to me. I have made a program which can run one HDF file. Without repeating the operations of extracting file and changing the name of .HDF file in my program every time, is it possible to make a new program where I just specify the path of folder and matlab extracts all the files and run the program which I have made? Thanks.

回答 (1 件)

per isakson
per isakson 2014 年 2 月 27 日
編集済み: per isakson 2014 年 2 月 27 日
Most probably, YES, with something like
sad = dir( fullfile( 'your_folder', '*.zip' ) );
for s = transpose( sad )
filenames = unzip( fullfile( 'your_folder', s.name ), outputdir );
hdf = position of hdf-file in filenames
your_program( fullfile( outputdir, filenames{hdf} ) )
delete( fullfile( outputdir, '*.*' ) )
end

カテゴリ

Help Center および File ExchangeHDF5 についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by