help I need matlab code that multiply each element in each coulmn by a each element in avector with the same length
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
maha ismail
le 13 Jan 2015
Commenté : Star Strider
le 13 Jan 2015
help I need matlab code that multiply each element in each coulmn by a each element in avector with the same length
0 commentaires
Réponse acceptée
Star Strider
le 13 Jan 2015
Modifié(e) : Star Strider
le 13 Jan 2015
Use bsxfun:
m = rand(10,5);
v = rand(10,1);
vm = bsxfun(@times, v, m);
Here, ‘m’ is the matrix, ‘v’ is the vector, and ‘vm’ is the element-by-element product of the columns of ‘m’ and column vector ‘v’.
4 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!