CMatrix:Rows CMatrix:Set

CMatrix:RowsUsed


The RowsUsed method returns the number of row members in the CMatrix.

Syntax

used = CMatrix:RowsUsed()

Remarks

This method returns the number of columns defined in the row having the most number of columns. This is not the same as the maximum index in any row.

Example

Suppose a CMatrix assigned to M contains 5 members as shown below. There are 3 rows in the matrix, with column indices ranging from 1 to 44:

 

M = CMatrix:new()

-- create a CMatrix

M:Set( 50, 44, 1805 )

-- set member

M:Set( 50, 44, -62 )

-- set member

M:Set( 50, 1, 600.5 )

-- set member

M:Set( 3, 44, 102 )

-- set member

M:Set( 120, 44, 25 )

-- set member

Printf("Used = %d", M:RowsUsed())

-- result: Used = 3

M:delete()

-- if finished with M, clean up memory

Related Topics

CMatrix, Exists