フィルターのクリア

How to insert a column of zero into a 3D matrix?

8 ビュー (過去 30 日間)
parslee
parslee 2022 年 3 月 30 日
回答済み: Simon Chan 2022 年 3 月 30 日
A = rand(128,256,36);
B = zeros(128,1);
I would like to concatenate B and A so that C = cat(2,B,A(:,:,1) but for every A(:,:,1), A(:,:,2), ... A(:,:,3).
How can I do this, instead of doing it manually?

採用された回答

Simon Chan
Simon Chan 2022 年 3 月 30 日
Try this
C=cat(2,A,repmat(B,1,1,size(A,3)));

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by