Borrar filtros
Borrar filtros

Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

Working With Matrices

1 visualización (últimos 30 días)
Euan
Euan el 23 de Nov. de 2011
Cerrada: MATLAB Answer Bot el 20 de Ag. de 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

Respuestas (1)

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

La pregunta está cerrada.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by