How can I code vector index plus

1 回表示 (過去 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 Center および File ExchangeMatrix Indexing についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by