Borrar filtros
Borrar filtros

kron function application but in 3d

3 visualizaciones (últimos 30 días)
Emma Gibney
Emma Gibney el 12 de Sept. de 2019
Respondida: Bruno Luong el 12 de Sept. de 2019
Is there a function that would replicate the elements of a matrix in 3d? If I had the matrix A(:,:,1)= [1 2; 3 4] and A(:,:,2)=[5 6; 7 8] I would want the output B(:,:,1)= B(:,:,2)= [1 1 2 2; 3 3 4 4] and B(:,:,3)=B(:,:,4)=[5 5 6 6; 7 7 8 8].
Thanks.

Respuestas (2)

Walter Roberson
Walter Roberson el 12 de Sept. de 2019
For duplicating elements with the duplicates of each element beside each other, see repelem()

Bruno Luong
Bruno Luong el 12 de Sept. de 2019
A(:,:,1)= [1 2; 3 4];
A(:,:,2)=[5 6; 7 8]
B = repelem(A,1,2,2)

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