フィルターのクリア

Elemtwise product of a matrix and a vector with one common dimmension

1 回表示 (過去 30 日間)
Maider Marin
Maider Marin 2011 年 2 月 8 日
I would like to do something like this Let say I have a matrix A of size 3x4
A =
0 1 2 3
1 0 0 0
5 0 1 0
and a vector v of size 3x1
v =
3
5
2
there is any way that I can produce an elementwise product as:
A v =
3*[ 0 1 2 3] 0 3 6 9
5*[ 1 0 0 0]= 5 0 0 0
2*[ 5 0 1 0] 10 0 2 0
without a loop?

採用された回答

Oleg Komarov
Oleg Komarov 2011 年 2 月 8 日
bsxfun(@times,v,A)
Oleg

その他の回答 (1 件)

Maider Marin
Maider Marin 2011 年 2 月 8 日
Thanks Oleg!!

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by