How can delete specific values from below matrix?

2 views (last 30 days)
Amir Torabi
Amir Torabi on 14 Dec 2019
Commented: Amir Torabi on 15 Dec 2019
Hi.
I'd like to delete the columns from matrix distance which don't meet the condition inx.
Thanks.
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

Answers (1)

Dyuman Joshi
Dyuman Joshi on 15 Dec 2019
To delete elements(columns here) from a matrix(distance) that don't meet a condition (distance>=50), you can do this
distance(distance<50)=[];
  1 Comment
Amir Torabi
Amir Torabi on 15 Dec 2019
Let me explain my goal clearly.
Inside the below image, you see several points. These are from matrix A included in the atrached file. I'd like to show just the points meet the condition (distance>50). It means i wanna show the points that have distance greater than 50 from each other in the image.
Thanks.
pic3.jpg

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!

Translated by