3D Array Multiplication with 2D Matrix
Afficher commentaires plus anciens
Hi,
I have a 3D array of lets say 500:10:32 elements. I want to multiple the first dimension of lthis array with another 1:500 matrix. How would I do this?
Regards
2 commentaires
Bob Thompson
le 28 Août 2019
Which 500 elements from the first matrix do you want to multiply the second matrix by? There are 320 different options.
Or are you looking to multiply all 320 sets of 500 against the new matrix?
Also, how are you looking to store your new 500 x 500 matrices?
Anum Ahmed
le 28 Août 2019
Réponse acceptée
Plus de réponses (3)
Bruno Luong
le 28 Août 2019
Modifié(e) : Bruno Luong
le 28 Août 2019
Simply do (R2016b or later)
data1 = data1 .* data2(:)
2 commentaires
Bob Thompson
le 28 Août 2019
Modifié(e) : Bob Thompson
le 28 Août 2019
Does this automatically choose the appropriate dimension though? I would logically make the connection between 500 and 500 elements in a dimension, but that doesn't mean a computer will.
Or will it produce 500 500x10x32 arrays, one for each element of data2?
Bruno Luong
le 28 Août 2019
Yes, the length of 500 of the first dimension must match. That's all.
Anum Ahmed
le 28 Août 2019
0 votes
stav marzuk
le 7 Déc 2021
0 votes
Hi i think i have the same problem, but i didnt sucssed to solve it.
I have an rgb photo with the size: 30432 29516 3
and i have a mask bw with the size 30432 29516
is it possible to multiply the two of them?
rgb .*bw
this multplication is not working, is there a solution?
Thanks in advance
Catégories
En savoir plus sur Creating and Concatenating Matrices dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!