フィルターのクリア

How can I insert values from the vertical 3rd matrix dimension in between the rows of the vertical 1st and 2nd dimension?

1 回表示 (過去 30 日間)
For matrix 210x2x4 I want to generate a 840x2 matrix, where in this order:
[matrix(1,:,1);matrix(1,:,2);matrix(1,:,3);matrix(1,:,4);matrix(2,:,1);matrix(2,:,2);....]
I'm still not clear how to insert values between values in matrices, any suggestions?

採用された回答

Andrei Bobrov
Andrei Bobrov 2011 年 6 月 13 日
reshape(permute(Mtx,[2 3 1]),2,[])'

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2011 年 6 月 13 日
Use permute() and then reshape(). Looks to me like you would want to permute() with [1 3 2].
  2 件のコメント
Adam Quintero
Adam Quintero 2011 年 6 月 13 日
ok, permute(matrix[ 1 3 2]) separates the x's from the y's. I am having difficulty setting reshape() to read the permuted matrix into two vectors, with the values from :,:,1 in a single column next to :,:,2 reading from the top row,left to right, and on down. I keep getting this error:
??? Error using ==> reshape
To RESHAPE the number of elements must not change.
Walter Roberson
Walter Roberson 2011 年 6 月 13 日
reshape(permute(matrix,[1 3 2]),[],2)

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

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by