How to SUM certain values of vector without using any loop?
显示 更早的评论
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.
采纳的回答
更多回答(1 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!