フィルターのクリア

Transpose Translation Vector for addresses

2 ビュー (過去 30 日間)
Aswas
Aswas 2016 年 5 月 20 日
コメント済み: Aswas 2016 年 5 月 20 日
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.

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2016 年 5 月 20 日
Y=sortrows(X)
  1 件のコメント
Aswas
Aswas 2016 年 5 月 20 日
Thanks Azzi, just got it.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMultidimensional Arrays についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by