0

If I have a matrix A, and I want to find the minimum value, I would think that the min function would be appropriate, but it is not:

A = [-2 1];

min(A)

Subscript indices must either be real positive integers or logicals.

However, using the max function (as follows) works perfectly fine:

-max(-A)

ans = -2

Even if your array has only positive values this works fine as well as in the following example:

A = [2 1]; -max(-A)

ans = 1

Can someone please exp[lain to me why the min function does not do this? Thanks!

0 Answers0