element to element sum

24 vues (au cours des 30 derniers jours)
milad farshbaf
milad farshbaf le 18 Déc 2018
Commenté : milad farshbaf le 18 Déc 2018
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

Réponse acceptée

Matt J
Matt J le 18 Déc 2018
X(1:end-1)+X(2:end)
  1 commentaire
milad farshbaf
milad farshbaf le 18 Déc 2018
thanks for your answer

Connectez-vous pour commenter.

Plus de réponses (1)

Matt J
Matt J le 18 Déc 2018
Modifié(e) : Matt J le 18 Déc 2018
conv(X,[1,1],'valid')

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by