Borrar filtros
Borrar filtros

Find distance between vectors given in a cell array

2 visualizaciones (últimos 30 días)
That Guy
That Guy el 12 de Nov. de 2020
Respondida: Sai Veeramachaneni el 16 de Nov. de 2020
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?

Respuestas (1)

Sai Veeramachaneni
Sai Veeramachaneni el 16 de Nov. de 2020
Below are the few steps which may help you.
  1. Since pdist() accepts matrix as an argument, you should convert cell array to matrix using cell2mat function
  2. Find pair wise distances using pdist() function
  3. Count number of distances greater than r distance.
Example-
p={[1,2],[3,4],[5,6],[7,8]};
matrixP=cell2mat(p(:));
distance = pdist(matrixP);
sum(distance>3)

Categorías

Más información sobre Point Cloud Processing en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by