sum, vector elements, except i-th
14 views (last 30 days)
Show older comments
hi,
how can I sum vector elements, say v = rand(1,30), except 12th one?
thanks,
0 Comments
Accepted Answer
Mona
on 8 Jul 2015
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)
See Also
Categories
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!