re-arrange matrix with for loop

1 回表示 (過去 30 日間)
marden
marden 2013 年 7 月 1 日
hi i am trying to re-arrange a matrix, I tried using reshape but I don't get the desire output.
the matrix I am trying to re-arrange looks like this
rgb=[a b c d e;f g h i j;k l m n o;p q r s t;u v w z y;z 1 2 3 4]
and I am trying to make it like this
RGB=[a f k;p u z;b g l;q v 1;c h m;r w 2;d i n;s z 3;e j o;t y 4]
I appreciate any help, apologies if this is really but my matlab skills are pretty bad, thanks

採用された回答

Matt J
Matt J 2013 年 7 月 1 日
編集済み: Matt J 2013 年 7 月 1 日
RGB=reshape(rgb,3,10).';
  1 件のコメント
marden
marden 2013 年 7 月 1 日
Thanks Matt, this seems to do the job.

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

その他の回答 (1 件)

Jonathan Sullivan
Jonathan Sullivan 2013 年 7 月 1 日
編集済み: Jonathan Sullivan 2013 年 7 月 1 日
reshape(permute(rgb,[2 1]),[],3)

カテゴリ

Help Center および File ExchangeResizing and Reshaping Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by