I have the following matrix

     3     6     5     4     1     2
     3     1     5     6     4     2
     4     3     5     1     6     2
     3     1     6     4     2     5
     3     2     5     6     1     4
     5     1     2     4     6     3

which is created by $n*r$ permutations of $1:n*r$, here $r=2,n=3$.

I want some trick (there must be one) to get the following two matrices

     3     1     2
     3     1     2
     3     1     2
     6     4     5
     5     6     4
     5     4     6

Any help would be greatly appreciated.

1 件のコメント

the cyclist
the cyclist 2017 年 4 月 1 日
I don't understand the rule for getting those two matrices from the first one. Can you explain it? Then maybe someone can help you program it.

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

回答 (1 件)

Walter Roberson
Walter Roberson 2017 年 4 月 2 日

0 投票

T1 = M(1:3,:).';
T2 = M(4:6,:).';
M1 = reshape(T1(T1<=3),3,3).';
M2 = reshape(T2(T2>3),3,3).';

カテゴリ

ヘルプ センター および File ExchangeCreating and Concatenating Matrices についてさらに検索

質問済み:

2017 年 4 月 1 日

回答済み:

2017 年 4 月 2 日

Community Treasure Hunt

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

Start Hunting!

Translated by