필터 지우기
필터 지우기

Element wise multiplication of a 4D Matrix

조회 수: 2 (최근 30일)
Iskindir Weldemeskel
Iskindir Weldemeskel 2023년 12월 4일
편집: John D'Errico 2023년 12월 4일
Say I have a 4D matrix called X_values the size of 3x3x3x10. I wanted to do an element wise multiplication along the 4th dimension and obtain a 3x3x3 matrix at the end. Any recommendation on how to do it?

답변 (1개)

John D'Errico
John D'Errico 2023년 12월 4일
편집: John D'Errico 2023년 12월 4일
A confusing question. MAYBE you are asking how to take the product of the elements along the 4th dimension? That is consistent with what you are asking for a result. And that is trivial. Just use prod. It works just like sum.
A = rand(3,3,3,10); % just create a matrix of the right shape
B = prod(A,4);
size(B)
ans = 1×3
3 3 3

카테고리

Help CenterFile Exchange에서 Operators and Elementary Operations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by