How to calculate the position and sequence of the element in the row vector?

 

Here is a syntax.

>> X = [2 3 4 4  8 9 6];

>> To find the first and fifth postion of row element in a vector X.

>> X(1) 

      = 2

>> X(5) 

     =8

>> To find the first postion to fifth postion in vector.

>> X(1:5)

     = [2 3 4 4 8]

>> To find the fifth posistion to last position in MATLAB.

>> X(4:end)

     = [4 8 9 6]

The result on MATLAB display:

In this post, I covered all the basics of the vector in MATLAB and also explained some of the mathematic operations on MATLAB vector.