CMatrix:Init CMatrix:Normalize

CMatrix:Members


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

Syntax

number = CMatrix:Members()

Remarks

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

M:delete()

-- if finished with M, clean up memory

Related Topics

CMatrix, Exists, Count