COUNT

Platform

x64, Win32, .NET

Purpose

Count the number of true elements of MASK along dimension DIM.

Class

Transformational function.

Syntax

INTEGER FUNCTION COUNT(MASK [,DIM])
LOGICAL MASK; INTEGER DIM

Description

MASK is a logical array. DIM is optional and is a value in the range 1 < DIM < n where n is the rank (i.e. the number of dimensions) of MASK. COUNT returns an integer array of the default kind type. If MASK has rank 1 or if DIM is not present then COUNT returns a scalar otherwise COUNT returns an array whose rank is one less than that of MASK. If MASK has rank 1 then a supplied value of DIM is ignored.

Return value

COUNT(MASK) returns the number of elements of MASK that are true.

If MASK has rank n greater than 1 then COUNT(MASK, DIM) returns a integer array of rank n - 1 whose elements are given by COUNT(MASK) applied along dimension DIM.

Example

If MASK =
then COUNT(MASK, 1) returns [2, 1, 0]

whilst COUNT(MASK, 2) returns [1, 2].

 

 

Basket
Empty
 
Copyright © 1999-2024 Silverfrost Limited