How to delete some elements from a vector in Matlab and Octave
To delete an element from a vector, assign a null value [ ] to the element
The parameter n is the position of the element in the index of the vector.
To delete some continuous elements in the index write this comand
The x parameter is the position of the first element of the range, the y parameter is the position of the last element of the range.
To delete all elements of a vector, assign a null value [ ] to the vector
This command deletes the elements present in the vector
Define a vector
>> v=['a'; 'b'; 'c'; 'd'; 'e'; 'f';'g']
The vector has seven elements
To delete the sixth element, type
Now the vector has six elements
To delete the group of elements between the second and fourth element type
>> v(4:6)=[ ]
Now the vector has 3 elements.
To delete all elements of the vector type
>> v=[ ]
This command deletes all elements in the vector.