Multiplying along the 3rd dimension of a 3D matrix

I have a 16x16x100 matrix. What is the fastest way to obtain the 16x16 product by multiplying all the 16x16 arrays?

Respuestas (2)

A = rand(16,16,100);
out = A(:,:,1);
for jj = 2:size(A,3)
out = out*A(:,:,jj);
end
James Tursa
James Tursa el 27 de Mzo. de 2015
Editada: James Tursa el 27 de Mzo. de 2015
If you mean element-wise multiply, then:
prod(your_matrix,3)

1 comentario

T S Mahesh
T S Mahesh el 27 de Mzo. de 2015
Sorry, I did not make it clear. I need matrix multiplication, not element-wise.

Iniciar sesión para comentar.

Categorías

Más información sobre Creating and Concatenating Matrices en Centro de ayuda y File Exchange.

Preguntada:

el 27 de Mzo. de 2015

Respondida:

el 27 de Mzo. de 2015

Community Treasure Hunt

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

Start Hunting!

Translated by