element to element sum

조회 수: 25 (최근 30일)
milad farshbaf
milad farshbaf 2018년 12월 18일
댓글: milad farshbaf 2018년 12월 18일
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
milad farshbaf
milad farshbaf 2018년 12월 18일
thanks for your answer

댓글을 달려면 로그인하십시오.

추가 답변 (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