Last active
August 29, 2015 14:20
-
-
Save l337quez/9a1b6d6bff3acb2861a2 to your computer and use it in GitHub Desktop.
Agregar y Quitar elementos de un Vector
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%GUARDAR PARTE DE UN VECTOR EN OTRA VARIABLE | |
>> v=[4 10 -3 7 -1 ]; | |
>> u=v(2:4) | |
u = 10 -3 7 | |
%AÑADIR ELEMENTOS A UN VECTOR | |
>>v=1:4 | |
v = | |
1 2 3 4 | |
%decimos que comience agregar numeros despues del ultipo campo lleno | |
%que es 4 y que llene hasta 10 campos, despues del ultimo campo lleno | |
%es el campo 5 hasta 10 y que agregue numeros del 7 al 22 en pasos de 3 | |
>> v(5:10)=7:3:22 | |
v = | |
1 2 3 4 7 10 13 16 19 22 | |
%ELIMINAR ELEMENTOS DE UN VECTOR | |
>> e=[ -1 1 -5 2 3] | |
e = -1 1 -5 2 3 | |
>> e(2:4)=[] | |
e = -1 3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment