Add n+1 element to a vector
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have a vector of the format:
x = [X1 X2 … Xn]
I want to add an element to the end, X(n+1). How do I do that?
ex: x = [ 1 4 2 8]
newX = [ 1 4 2 8 9]
0 commentaires
Réponse acceptée
Peng Li
le 10 Avr 2020
If your X is a row vector, using newX = [X, aNewElement];
If your X is a column vector, using newX = [X; aNewElement];
2 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Automated Driving Toolbox 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!