CMatrix:Empty CMatrix:Get

CMatrix:Exists


The Exists method returns true if a CMatrix member exists with the specified indices.

Syntax

bSuccess = CMatrix:Exists( row, col )

Remarks

If you use Init then the first n x m members are set and this function will return true if tested with an index in range. Otherwise, members are uninitialized if you do not Set them or if you Remove them.

Example

The following script fragment tests whether the matrix member at index [2][2] has been initialized:

 

M = CMatrix:new()

-- create a CMatrix

M:Set( 1, 3, 0.112 )

-- set member [1][3]

M:Set( 2, 4, 5.5 )

-- set member [2][4]

if ( M:Exists(2,2) ) then s = "yes"

-- has member [2][2] been set?

   else s = "no" end

 

Printf("M[2][2] exists= %s", s)

-- result: M[2][2] exists= no

Related Topics

CMatrix, Count