CMatrix:Remove CMatrix:RowExists

CMatrix:RemoveRow


The RemoveRow method removes the CMatrix row at index n.

Syntax

CMatrix:RemoveRow( n )

    n is the index of the row to be removed.

Remarks

This method removes all columns data in the row as well as the row itself. This decreases by 1 the row count returned by Count.

Example

The following script fragment removes the row at index n = 100:

 

M = CMatrix:new()

-- create a CMatrix object

M:Set( 1, 4, "s1" )

-- set member in row 1

M:Set( 2, 40, "s2" )

-- set member in row 2

M:Set( 2, 18, "s3" )

-- set member in row 2

M:Set( 2, 120, "s4" )

-- set member in row 2

M:Set( 10, 120, "s5" )

-- set member in row 10

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

-- result: Members = 5

M:RemoveRow( 2 )

-- remove the row at index 2

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

-- result: Members = 2

Related Topics

CMatrix, Remove, Count, Members