Getting sum of Elements of a Vector

1 次查看(过去 30 天)
Hi, I am writing a code in which i have to take the sum of a defined range of elements of a Vector. For e.g From (1,3) to (1,5). Means the sum of the value at Column 3,4 and 5. I have used the command sum in the following way but its giving ambiguous answers. sum(A(1,3):A(1,5)) Can anyone please guide me how to perform this task? Also inform me what mistake I am doing so I may correct my understanding. Thanks a lot.

采纳的回答

KSSV
KSSV 2017-3-29
sum(A(1,3:5))

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by