Borrar filtros
Borrar filtros

Transpose Translation Vector for addresses

2 visualizaciones (últimos 30 días)
Aswas
Aswas el 20 de Mayo de 2016
Comentada: Aswas el 20 de Mayo de 2016
Hi, I have G =
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 0 0 0 0 0 0 0 0 0 0 0 0
-1 0 0 0 0 0 0 0 5 5 5 0 0
-1 0 0 0 0 0 0 0 0 0 5 0 0
-1 0 0 0 0 0 0 0 0 0 5 0 0
and have translation vector for X....
X = zeros(nx,2);
[r, c] = find(G == 0); % Fill (X) with free nodes from (G)
X = [r, c]
X =
2 2
3 2
4 2
5 2
2 3
3 3
4 3
5 3
2 4
3 4
4 4
5 4
. .
. .
. .
which is reading columnswise.
I would like to sort in this order
X =
2 2
2 3
2 4
. .
3 2
3 3
3 4
. .
4 2
4 3
4 4
. .
5 2
5 3
5 4
I have tried
X(r,c) = reshape([X' 5], [], rows - 1)'
but get:
Error using horzcat Dimensions of matrices being concatenated are not consistent.

Respuesta aceptada

Azzi Abdelmalek
Azzi Abdelmalek el 20 de Mayo de 2016
Y=sortrows(X)

Más respuestas (0)

Categorías

Más información sobre Multidimensional Arrays 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