extraction of longitudes and latitudes of areas with different data from NaN
조회 수: 5 (최근 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!