Silverfrost Logo About Us | Contact Us
 

MAXLOC

Platform

x64, Win32, .NET

Purpose

To get the first position in an array where the element has the maximum value for the array.

Class

Transformational function.

Syntax

INTEGER FUNCTION MAXLOC(ARRAY, DIM [, MASK])
INTEGER FUNCTION MAXLOC(ARRAY [, MASK])
INTEGER DIM
LOGICAL MASK

Description

ARRAY is an integer or real array. DIM is a scalar integer in the range 1 < DIM < n where n is the rank of ARRAY. MASK is a logical array that is conformable with ARRAY.

Return value

This function determines the location of the first element of ARRAY along dimension DIM having the maximum value of the elements identified by MASK.

If DIM is not present, the result is an array of rank one and size n, otherwise the result is of rank n - 1 and has a shape that is the same as that of ARRAY but omitting dimension DIM.

Example

If A = [3, 2, 9, 9] then MAXLOC(A) is 3.

If A = then MAXLOC(A, MASK = A .LT. 5) is [1, 4] which is the location of the largest value for this mask.

If A = then MAXLOC(A, DIM = 1) is [2, 2, 2, 1] and MAXLOC(A, DIM = 2) is [4, 3].

 

 

Copyright © 1999-2017 Silverfrost Limited