How to push a variable in a vector in Matlab?

264 visualizaciones (últimos 30 días)
Manuel Ignacio
Manuel Ignacio el 7 de Feb. de 2013
Respondida: Jozef Lukac el 29 de Dic. de 2020
Something like this:
A = [1 2 3];
push(A, 4); % Something like Push
% A = [1 2 3 4]
Thanks.

Respuesta aceptada

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

Iniciar sesión para comentar.

Más respuestas (1)

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

Categorías

Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by