# How to find the minimum value from a vector in Matlab and Octave

To get the minimum value of elements from a vector use the function min ()

**min(v)**

The v parameter is a vector.

This function finds the element with the minimum value of the vector.

**Note**. The min() function finds the minimum value on both numeric and alphanumeric elements. On alphanumeric elements the min () function finds the minimum value of the ASCII code of the characters.

## Examples

**Example 1**

Create a numeric vector

>> v=[5; 1; 4; 7; 3]

To find the minimum value use the min command

>> min(v)

ans = 1

The minimum value in the array is equal to 1.

**Example 2**

Create a vector with alphanumeric elements

>> w=['g'; 'b'; 'd'; 'z'; 'k']

To find the minimum value use the **min()** function

>> min(w)

ans = 98

In this case the min() function finds the character with the lowest ASCII code.

The output is 98. I's the ASCII code of the character "b".

>> char(98)

ans = b

**Report us an error or send a suggestion to improve this page**