How can I code vector index plus

조회 수: 2 (최근 30일)
DongShin Yang
DongShin Yang 2016년 3월 5일
댓글: DongShin Yang 2016년 3월 9일
n is an index of vector. C is a vector. How can I code that? Cn + C(n+1) C(n+1) is next(+1) index of n.

채택된 답변

John D'Errico
John D'Errico 2016년 3월 5일
Code what? If n is an integer, then
C(n) + C(n+1)
does exactly that.
Are you asking to form the sum of all consecutive pairs of elements? Be explicit about your question. Once you are able to ask a clear question, the answer is often trivial.
n = numel( C );
C(2:n) - C(1:(n-1))
  댓글 수: 2
DongShin Yang
DongShin Yang 2016년 3월 9일
Thank your answer. more informations are that [How can I modify vector indexs and values.]
DongShin Yang
DongShin Yang 2016년 3월 9일
You can fine it on search answers. Please help me.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by