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개)

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.

카테고리

Help CenterFile Exchange에서 Creating 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