How to push a variable in a vector in Matlab?

56 vues (au cours des 30 derniers jours)
Manuel Ignacio
Manuel Ignacio le 7 Fév 2013
Something like this:
A = [1 2 3];
push(A, 4); % Something like Push
% A = [1 2 3 4]
Thanks.

Réponse acceptée

Matt J
Matt J le 7 Fév 2013
Modifié(e) : Matt J le 7 Fév 2013
A(end+1)=4;
or
A=[A,4];
  3 commentaires
Khac Dat Nguyen
Khac Dat Nguyen le 24 Avr 2019
about string array? help me
Matt J
Matt J le 24 Avr 2019
This works for any array.

Connectez-vous pour commenter.

Plus de réponses (1)

Jozef Lukac
Jozef Lukac le 29 Déc 2020
I have created an immitation of STL vector in Matlab. Check it out. :)

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by