필터 지우기
필터 지우기

How to find the distance between vectors given in a cell array?

조회 수: 1 (최근 30일)
That Guy
That Guy 2020년 11월 12일
댓글: Ameer Hamza 2020년 11월 12일
say i have a cell array in the form p = {[x1, y1], [x2, y2],...,[xn, yn]}
i want to find the number of points that arent within r distance of eachother. I know that pdist will find the distance between points but im not sure how to break this cell array up in order to apply this function. Any help?

채택된 답변

Ameer Hamza
Ameer Hamza 2020년 11월 12일
You can apply pdist() like this
p = {[x1, y1], [x2, y2], [x3, y3]};
P = vertcat(P{:});
D = pdist(P);
  댓글 수: 2
That Guy
That Guy 2020년 11월 12일
thats exactly what i was looking for! thanks!
Ameer Hamza
Ameer Hamza 2020년 11월 12일
I am glad to be of help!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by