Hi, I am trying to multiply a 72*51*51 3D array with a 51*51 2D matrix elementwise. How do I go about this using a for loop?
Thank you.

回答 (1 件)

Voss
Voss 2022 年 11 月 9 日
編集済み: Voss 2022 年 11 月 9 日

0 投票

If A is your 72*52*52 array and B is your 52*52 matrix, then:
result = A .* repmat(permute(B,[3 1 2]),[size(A,1) 1 1]);
No need for a for loop.

カテゴリ

ヘルプ センター および File ExchangeMatrices and Arrays についてさらに検索

質問済み:

2022 年 11 月 9 日

編集済み:

2022 年 11 月 9 日

Community Treasure Hunt

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

Start Hunting!

Translated by