フィルターのクリア

product of sum of the elements along the fourth dimension in a 4D matrix

4 ビュー (過去 30 日間)
Athira Surendran
Athira Surendran 2017 年 1 月 17 日
回答済み: Adam 2017 年 1 月 17 日
Hi, I've a 4D matrix. I want to take the product of sum of the elements along the fourth dimension. Basically i want to do this "ΠΣ" operation.
For example, a(i,j,k,l) is a 4D matrix. I want the sum along fourth dimension for all i,j,k values and store it to a 3D matrix b(i,j,k). Then I want to find the product of all elements along the third dimension in b for all i,j values and store it to a 2D matrix c(i,j).
How to do this? Thanks in advance.

回答 (1 件)

Adam
Adam 2017 年 1 月 17 日
a = ones( 3, 4, 5, 6 );
b = sum( a, 4 );
c = prod( b, 3 );
seems to do the job

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by