How to find the maximum and minimum element of the vector in MATLAB?

 

Here is a syntax.

>> X = [2 4 1 7 8];

>> min(X)

     = 1

>> max(X)

     = 8

The Result on MATLAB display:

6. Colon Function for Vector:

For MATLAB, the colon (:) function are express the sequence and position of the elements in the vector.

Example: