필터 지우기
필터 지우기

How to replace double values into an array with NaN?

조회 수: 6 (최근 30일)
Loren99
Loren99 2022년 8월 24일
편집: Loren99 2022년 8월 25일
Hi everyone! I need a help with this code. I have a set of points at 90 meters of altitude and another set of points at 140 meters of altitude. Then I have to find for each point at the higher altitude, the nearest point at the lower altitude.
However I would add a statement:
I would like to obtain that closest_point_lower_altitude continues to have a dimension 7x2 but the points in correspondence of a minimum distance > 10 have to be NaN values. How can I do it? Thanks in advance

채택된 답변

David Hill
David Hill 2022년 8월 24일
new_points_90 = load('new_points_90.mat').new_points;
new_points_140 = load('new_points_140.mat').new_points;
d=pdist2(new_points_90,new_points_140);
[m,idx]=min(d);%provides minimum distance and idx of 90 (only one point has <=10 minimum distance
Points=new_points_90(idx,:);
Points(m>10,:)=nan;

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Specialized Messages에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by