how to find elements between two values
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I want to check the netcdf files one by one based on the maximum and minimum of longitude and latitude in the corresponding files whether those are in between the maximum and minimum defined longitude and latitude, "latlim = [a, b]; lonlim = [c , d]". I wrote the following code, but it could not copy the corresponding files in the new file.
I really thanks in advance any help or suggestion.
filesout = {};
for i = 1 : length(files)
disp(['File number = ' , num2str(i)])
filename = files{i};
lat_min = str2double(ncreadatt(filename,'/','geospatial_lat_min'));
lat_max = str2double(ncreadatt(filename,'/','geospatial_lat_max'));
lon_min = str2double(ncreadatt(filename,'/','geospatial_lon_min'));
lon_max = str2double(ncreadatt(filename,'/','geospatial_lon_max'));
lon_argo = [lon_min, lon_max]; lat_argo = [lat_min, lat_max];
%
if ( (lon_argo(:) <= (min(lonlim))) & (lon_argo(:) > (max(lonlim))) & ...
(lat_argo(:) <= (min(latlim))) & lat_argo(:) > (max(latlim)) )
filesout = filename ;
fn = str2double(ncreadatt(filesout,'/','platform_code'));
disp(['Platform code = ' , num2str(fn)])
else
continue;
end
end
0 Commenti
Risposte (0)
Vedere anche
Categorie
Scopri di più su Data Types in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!