element to element sum

24 次查看(过去 30 天)
hi
i have X = [1 5 7 6 9 2 3 1 4 8 6 5]; and i want to do [1+5 5+7 7+6 6+9 ...] how can i do that?
thanks

采纳的回答

Matt J
Matt J 2018-12-18
X(1:end-1)+X(2:end)

更多回答(1 个)

Matt J
Matt J 2018-12-18
编辑:Matt J 2018-12-18
conv(X,[1,1],'valid')

类别

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