Open files with certain file size
2 次查看(过去 30 天)
显示 更早的评论
Hi I have hundreds of files with a similar name. I can open them all with the following code:
% Open the HDF5 File.
for k = 1:365
FILE_NAME = sprintf('MLS-Aura_L2GP-O3_v04-20-c01_2006d%03d.SUB.he5',k);
file_id = H5F.open(FILE_NAME, 'H5F_ACC_RDONLY', 'H5P_DEFAULT');
end
now I only want to open files when the file size is greater than 37 KB. How do I do that ?
0 个评论
采纳的回答
KSSV
2017-3-31
files = dir('your file extension') ;
% loop for each file
for i = 1:length(files)
if files(i).bytes*1000 > 37 % if file size is > 37 do what you want
filename = files(i).name ;
disp(filename)
%open your file do what you want
end
end
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Other Formats 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!