Sort cell array base on the 2D value

1 visualización (últimos 30 días)
LiangYu
LiangYu el 9 de Jun. de 2014
Editada: Cedric el 10 de Jun. de 2014
I have a 3X3 cell array and each element store a (x,y) point.
The point are generate by random number from [0,1].
What I want to do is sort the cell array so that it looks like following
ex: 9 points
each circle is one 2D point
index:(1,1) in the left top corner and (3,3) to the right bottom corner as the usual array index
that is to ensure the topological order.
How do I do it?
Thank in advance.
for the example
pairs = [4 9 2 6 5 1 7 8 3; 9 6 2 1 3 8 7 4 5] (row 1 = x-values, row 2 = y-values))
what I want to do is put them in the cell array so that they can be connected by read lines like the image's topology.
  2 comentarios
Cedric
Cedric el 9 de Jun. de 2014
I up-vote this question; I don't have time now, but it is interesting.. not as simple as it looks.
Cedric
Cedric el 10 de Jun. de 2014
Editada: Cedric el 10 de Jun. de 2014
You built an example with 9 nodes, but how many do you have in reality?

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Shifting and Sorting Matrices 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