How do I multiply vector elements in the following fashion???
2 次查看(过去 30 天)
显示 更早的评论
Suppose I have A=[18 44 20 55] & B=[4 6]
Now I want C=[18*4 44*4 20*6 55*6]
i.e I want to multiply first element of B with first pair of elements in A
and second element of B with second pair of A and so on...
0 个评论
采纳的回答
Azzi Abdelmalek
2016-4-2
编辑:Azzi Abdelmalek
2016-4-2
A=[18 44 20 55]
B=[4 6]
out=reshape(bsxfun(@times,A',B),1,[])
3 个评论
Azzi Abdelmalek
2016-4-2
Then you have to reshape A
reshape(bsxfun(@times,reshape(A,2,2),B),1,[])
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!