how to generate subsequent combination of elements
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Jay Hanuman
le 15 Nov 2016
Modifié(e) : John D'Errico
le 15 Nov 2016
I have sequence t=1 3 4 4 6 2 2 2 2 1 4. I want to generate combination of two subsequent elements. i.e. 13 34 44 46 62 22 22 22 21 14. how to do it
0 commentaires
Réponse acceptée
John D'Errico
le 15 Nov 2016
Modifié(e) : John D'Errico
le 15 Nov 2016
What does the number 13 mean? 13 is just a symbol. In base 10, it means the number (1*10+3). So creating your vector is trivial.
s = 10*t(1:end-1) + t(2:end);
Learn to use vector operations in MATLAB. Your code will benefit greatly.
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Elementary Math 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!