functionvectorMin

Returns the smallest element of a vector

Information

Syntax

(b, i) = vectorMin (A, first, last);

Description

b is the smallest element of vector A between indices first and last.

i contains the index of b in vector A.

First and last are optional. If first is omitted, then first = 1. If last is omitted, then last equals the size of A.

Examples

(b, i) = vectorMin({1.3, 1.2, 7.4, 3.6, 20.9, 0, -6.7, -100, 5, 0.1});

returns 
b = -100;
i = 8;

    (b, i) = vectorMax({1.3, 1.2, 7.4, 3.6, 20.9, 0, -6.7, -100, 5, 0.1}, 2, 6);

returns 
b = 0;
i = 6;

Inputs

TypeNameDefaultDescription
Real[:]A
Integerfirst1
Integerlastsize(A, 1)

Outputs

TypeNameDefaultDescription
Realb
Integeri