How to add two vectors or arrays with different length?
4 次查看(过去 30 天)
显示 更早的评论
Dear all , Anyone could help to substract or add two vectors ith different length.For instance , if i have these to vectors
a=[1 2 0 3 0 4 ] with six elements b=[1 2 3 4 5 6 7 8 9] with 9 elements. My question as follow: .First ,i have to make the a-vectors by skipping all zeros values as new a=[1 2 3 4].
.Then , i have to add the new vector of a with b exactly each element in a to each element of b, and the zeros element of a should not be inculded for the assigned values in b.The results should be as anew = [ 1 2 3 4 ] bnew= [1 2 4 6 ] anew+bnew =[2 4 7 10] Please if you can help me as soon as possible. Regards mah
0 个评论
回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Distribution Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!