Illustration of Mode
When there is more than one value with similar (highest) frequency, then the smaller value is mode. In the case below, as 3 and 8 appear twice in the vector, then the smaller value (3) is mode:
>> x = [3 8 5 3 4 1 8];
>> mode(x)
ans =
3