What to use instead of horzcat for N-D Arrays?

6 ビュー (過去 30 日間)
Douglas Anderson
Douglas Anderson 2018 年 5 月 23 日
コメント済み: Douglas Anderson 2018 年 5 月 23 日
Hello.
I have a 3D array (let's say 3 x 4 x 100, call it AA) and want to add zeros to the end of the long dimension (let's say to get it to 3 x 4 x 200, adding on BB that is also 3 x 4 x 100 with zeros). horzcat() isn't happy, and [AA BB] won't do it.
Suggestions? Thanks!
Doug Anderson

採用された回答

James Tursa
James Tursa 2018 年 5 月 23 日
AA(end,end,200) = 0;
  1 件のコメント
Douglas Anderson
Douglas Anderson 2018 年 5 月 23 日
Brilliant! Thank you!

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

その他の回答 (1 件)

Steven Lord
Steven Lord 2018 年 5 月 23 日
The horzcat function concatenates horizontally, in dimension 2.
The vertcat function concatenates vertically, in dimension 1.
The cat function lets you concatenate in whatever dimension you specify. As shown in the example on the cat documentation page, you want to concatenate in dimension 3.
  1 件のコメント
Douglas Anderson
Douglas Anderson 2018 年 5 月 23 日
Thank you Steven -- that's also great.

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

カテゴリ

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

製品


リリース

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by