how can i add a 3dim matrix to another one as every odd cell

1 回表示 (過去 30 日間)
Nahid Atashi
Nahid Atashi 2018 年 11 月 19 日
コメント済み: Nahid Atashi 2018 年 11 月 19 日
Hi everybody,
I have two matrices with 3 dim A(4*20*55512) and B(4*20*5512). the third dimention is time. I want to put matrix B below the matrix A in third dim but
as the first cell should be the first value of matrix A and the second cell should be the first value of matrix B. i can do it for a 2 dim matrix by reshape
but not for 3dim. can eveyone help me please? thanks
time in matrix A is (0,6,12,18) and in matrix B (3,9,15,21). so i want to have a matrix with C(4*20*11024) and time would be (0,3,6,9,12,15,18,21).

採用された回答

Andrei Bobrov
Andrei Bobrov 2018 年 11 月 19 日
s = size(B);
out = zeros(c .* [1,1,2]);
out(:,:,1:2:s(3)*2) = A(:,:,1:s(3));
out(:,:,2:2:s(3)*2) = B;
  1 件のコメント
Nahid Atashi
Nahid Atashi 2018 年 11 月 19 日
thank you so much Andrei, the answer was perfect

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by