How to push a variable in a vector in Matlab?

55 Ansichten (letzte 30 Tage)
Manuel Ignacio
Manuel Ignacio am 7 Feb. 2013
Beantwortet: Jozef Lukac am 29 Dez. 2020
Something like this:
A = [1 2 3];
push(A, 4); % Something like Push
% A = [1 2 3 4]
Thanks.

Akzeptierte Antwort

Matt J
Matt J am 7 Feb. 2013
Bearbeitet: Matt J am 7 Feb. 2013
A(end+1)=4;
or
A=[A,4];
  3 Kommentare
Khac Dat Nguyen
Khac Dat Nguyen am 24 Apr. 2019
about string array? help me
Matt J
Matt J am 24 Apr. 2019
This works for any array.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

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

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by