Multiply different sized arrays by cycling smaller array
显示 更早的评论
a = 1,2,3
b = 4,5,6,7,8
c=a*b
I want c=a*b in the form:
C(a=1), C(a=2), C(a=3)
where c is three seperate 1x5 arrayss
I am envisaging a for loop cycling through array(a) but can't get it to work
采纳的回答
更多回答(1 个)
Perhaps one of these is what you describe:
a = [1,2,3];
b = [4,5,6,7,8];
c = a.'.*b
c = a.*b.'
c = reshape(c,1,[])
类别
在 帮助中心 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!