Azzera filtri
Azzera filtri

Info

Questa domanda è chiusa. Riaprila per modificarla o per rispondere.

Working With Matrices

1 visualizzazione (ultimi 30 giorni)
Euan
Euan il 23 Nov 2011
Chiuso: MATLAB Answer Bot il 20 Ago 2021
I have a matrix and a vector
A= 1 2 3
4 5 6
B=[10 20 30]
Im trying to calculate
C= 1*10 2*20 3*30
4*10 5*20 6*30
Could anyone help me do this? Thanks

Risposte (1)

Jan
Jan il 23 Nov 2011
A = [1 2 3; 4 5 6];
B = [10 20 30];
C = bsxfun(@times, A, B)
Or:
C = A .* B(ones(1, 2), :)

Questa domanda è chiusa.

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by