Well unless your matrices overlap, this is a simple matter of checking your current position.
Even with a staggered layout it would be rather simple. Build an array to store each matrix' position. There are commands for retrieving the matrix position but not it's width and depth, so we'll need to store this.
If your matrices are in a staggered design like Nomad said, then this is how I'd do it:
Type Matrix_Info
x as integer
z as integer
width as integer
depth as integer
EndType
dim matrixPosInfo() as Matrix_Info
function getCurrentMatrix(x, z)
for i = 1 to array count(matrixPosInfo)
if x >= matrixPosInfo(i).x and <= matrixPosInfo(i).x+matrixPosInfo(i).width
if z >= matrixPosInfo(i).z and <= matrixPosInfo(i).z+matrixPosInfo(i).depth
exitfunction i
endif
endif
next i
endfunction -1
If they're laid out in a more predictable grid, and of the same size, then it would be a simple matter of dividing the current position by the width and depth of a matrix.
Example, assuming matrices are all the same size and displayed in a 3x3 grid:
[1][2][3]
[4][5][6]
[7][8][9]
col = posX / matWidth + 1
row = posZ / matDepth
matrixId = row*3 + col
col will be between 1 and 3.
row will be between 0 and 2.
I also don't think having 1000 matrices is the best method. Ten would probably be more than enough, you don't want build more stuff into memory than you have to.
> SELECT * FROM users WHERE clue > 0
> 0 rows returned