How can delete specific value from the below matrix?

조회 수: 1 (최근 30일)
Amir Torabi
Amir Torabi 2019년 12월 14일
댓글: David Hill 2019년 12월 14일
Hi.
I'd like to delete the columns in the matrix A which don't meet the condition inx.Also, in matrix distance, And update the matrix A to a new matrix.
MAtrix A, contains coordinates. And the distance of each row was calculated from all of other coordinates and stored into the distance matrix.
Thanks.
load A;
for ig= 1:length(A)
distance(:,ig) = sqrt(abs(((A(:,1)-A(ig,1)).^2+(A(:,2)-A(ig,2)).^2)));
inx = distance>=50;
end
  댓글 수: 1
David Hill
David Hill 2019년 12월 14일
Your question is quite confusing. Do you only want to remove coordinate rows of A where all distances between a coordinate and all other coordinates is <50? Otherwise, it does not make sense to me. You said delete columns of A not meeting the condition, but there are only two columns. You must mean to delete rows of A not meeting the condition (I assume that the coordinates in a particular row of A are always less than a distance of 50 between all the other coordinates).

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by