Borrar filtros
Borrar filtros

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

2 visualizaciones (últimos 30 días)
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).

Respuesta aceptada

Andrei Bobrov
Andrei Bobrov el 19 de Nov. de 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;

Más respuestas (0)

Categorías

Más información sobre Matrices and Arrays en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by