extraction of longitudes and latitudes of areas with different data from NaN
6 views (last 30 days)
Show older comments
Good evening
please need help on matlab i have data structured like this:
data1 (50 * 60) with NaN and real values and
longitude (lon) 1 * 60, latitude (lat) 1 * 50.
I would like to extract the longitudes and latitudes having real values on the data1 matrix.
%% extraction des longitudes et latitudes
load('matrice_derol.mat')
0 Comments
Answers (2)
Image Analyst
on 23 Dec 2021
You tagged chunru, but can other people answer or you only want answers from him? If you'd like to see my solution, it's here:
% Extraction des longitudes et latitudes
s = load('matrice_derol.mat')
data = s.data1;
imshow(data, [], 'InitialMagnification', 1000)
axis('on', 'image');
lat = s.lat
lon = s.lon
% If data has lon in columns, and lat in rows
% then you can get non-NaN coordinates like this:
[nonNanLat, nonNanLon] = find(~isnan(data))
0 Comments
Voss
on 23 Dec 2021
This will take the lat/lon values where data1 has any non-NaN value at that lat/lon:
S = load('matrice_derol.mat')
good_idx = ~isnan(S.data1);
good_lat = S.lat(any(good_idx,2))
good_lon = S.lon(any(good_idx,1))
0 Comments
See Also
Categories
Find more on Block Libraries in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!