How to SUM certain values of vector without using any loop?
Show older comments
I have a vector : y[n] , containing n values.I want to do this sum:

I can do it with a loop like this:
for k = 2:(m+1)
p=p+y((2*k)-1);
end
Is there way to do this sum without a for/while loop cycle?
Thank you.
Accepted Answer
More Answers (1)
Kristof Laszlo Papp
on 17 Dec 2018
0 votes
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!