i have a matrix like:A=[9 7 8 4 2 5 1 8 6 12]. i wanna add the first 5 elements .how can I do this?

1 次查看(过去 30 天)
i have a matrix like:A=[9 7 8 4 2 5 1 8 6 12]. i wanna add the first 5 elements .how can I do this?

采纳的回答

Image Analyst
Image Analyst 2016-4-23
Try this:
sumFirst5 = sum(A(1:5));

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Migrate GUIDE Apps 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by