Open files with certain file size
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
David du Preez
am 31 Mär. 2017
Kommentiert: David du Preez
am 1 Apr. 2017
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 Kommentare
Akzeptierte Antwort
KSSV
am 31 Mär. 2017
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
1 Kommentar
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Other Formats finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!