How can delete specific value from the below matrix?
1 次查看(过去 30 天)
显示 更早的评论
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
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 Center 和 File Exchange 中查找有关 NaNs 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!