sum, vector elements, except i-th
5 次查看(过去 30 天)
显示 更早的评论
hi,
how can I sum vector elements, say v = rand(1,30), except 12th one?
thanks,
0 个评论
采纳的回答
Mona
2015-7-8
You can always do the sum, then subtract that single element, 12th, from the sum.
v = rand(1,30);
sum_except12=sum(v)-v(12)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Operators and Elementary Operations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!