How can I code vector index plus
9 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
DongShin Yang
le 5 Mar 2016
Commenté : DongShin Yang
le 9 Mar 2016
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.
0 commentaires
Réponse acceptée
John D'Errico
le 5 Mar 2016
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 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Matrix Indexing dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!