How to push a variable in a vector in Matlab?

202 visualizzazioni (ultimi 30 giorni)
Something like this:
A = [1 2 3];
push(A, 4); % Something like Push
% A = [1 2 3 4]
Thanks.

Risposta accettata

Matt J
Matt J il 7 Feb 2013
Modificato: Matt J il 7 Feb 2013
A(end+1)=4;
or
A=[A,4];

Più risposte (1)

Jozef Lukac
Jozef Lukac il 29 Dic 2020
I have created an immitation of STL vector in Matlab. Check it out. :)

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by