MATLAB: How to sum individual elements of a vector

elementsintegrationvector slice

Suppose I have a vector a=[1;2;3;4;5;6;7;9;10] Can anyone tell me if I want to integrate from 6th element to 10th element of the column vector

Best Answer

sum(a(6:10))