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 |
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
%otra forma de guardar el tamaño del vector | |
>> r=[5 3 -5]; | |
%guardando el primer campo del vector | |
>> r(1) | |
ans =5 | |
%guardando el tamaño del vector | |
>> r(end) | |
ans =-5 | |
>> length(r) | |
ans = 3 |
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
%Si queiremos saber cuantos campos tiene un vector, para luego | |
%guardar el vector en varias variables | |
%dado el vector v=[0 2 5 3 6 7 8]; | |
v=[0 2 5 3 6 7 8]; | |
%para conocer el tamaño del vector usamos el comando size() | |
size(v) | |
ans = | |
1 7 | |
%vemos que el resultado del tamaño nos dice que hay 7 campos | |
%0 2 5 3 6 7 8 = 7 campos |
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 un vector en Variables | |
a=[2 3]; | |
b=a(1); | |
c=a(2); | |
% Por lo tanto el primer campo del vector sera asignado a la | |
%variable "a" y el segundo campo a la variable "b" | |
NewerOlder