Azzera filtri
Azzera filtri

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

1 visualizzazione (ultimi 30 giorni)
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).

Risposta accettata

Andrei Bobrov
Andrei Bobrov il 19 Nov 2018
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;

Più risposte (0)

Categorie

Scopri di più su Resizing and Reshaping Matrices in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by