Concatenate layered matrix into one layer

I have a 2x133xi layered matrix. How can I take the i layers and combine it into a single layer matrix? So if i = 5 and I had a 2x133x5 matrix, the end result would be just a 2x665? I tried using the cat function but I can't seem to automate it for any number i.

 採用された回答

OCDER
OCDER 2018 年 7 月 12 日
編集済み: OCDER 2018 年 7 月 12 日

0 投票

a = randi(10, 2, 133, 5);
b = reshape(a, size(a, 1), size(a, 2) * size(a, 3));

2 件のコメント

Andrew Poissant
Andrew Poissant 2018 年 7 月 12 日
Worked like a charm, thanks!
OCDER
OCDER 2018 年 7 月 12 日
You're welcome!

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

その他の回答 (0 件)

カテゴリ

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

質問済み:

2018 年 7 月 12 日

コメント済み:

2018 年 7 月 12 日

Community Treasure Hunt

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

Start Hunting!

Translated by