extraction of longitudes and latitudes of areas with different data from NaN
6 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(2 个)
Image Analyst
2021-12-23
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 个评论
Voss
2021-12-23
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Block Libraries 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!