How can delete specific value from the below matrix?

1 view (last 30 days)
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 Comment
David Hill
David Hill on 14 Dec 2019
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).

Sign in to comment.

Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!