CMatrix:Members


The Count method returns the total number of members in the CMatrix object.

Syntax

number = CMatrix:Members()

where

    number is the number of members defined in the matrix. On failure or if the matrix is empty, 0 is returned.

  

This method returns the number of members (or values) in the CMatrix. This is not the same thing as the maximum index in either the column or row direction. For example, if the CMatrix has 3 members in these two rows: members at indices [1][1], [2][1], and [1000][1]. Then members = 3, but Count = 2

Example

Suppose a CMatrix assigned to M contains 3 members as shown below:

M = CMatrix:new()

-- create a CMatrix

M:Set( 2, 44, 1805 )

-- set member 2, 44

M:Set( 50, 20, 102 )

-- set member 50, 20

M:Set( 120, 2, 600.5 )

-- set member 120, 2

Printf("N = %d", M:Members() )

-- result: N = 3

Related Topics

Exists

Count

CMatrix Class