for Dim ( 50, 50 ) it should be ...
index = 10
value = MyArray( ( Index mod 51 ) + floor( index / 51 ))
quick demo ..
index = 10
value = MyArray( ( Index mod 51 ) + floor( index / 51 ))
quick demo ..
Graphics 640,480,16,1 Const Xcomp = 10 Const Ycomp = 5 Dim MyArray( Xcomp-1 , Ycomp-1 ) SetBuffer BackBuffer() ;populate it For y = 0 To Ycomp - 1 For x = 0 To Xcomp - 1 Index = x + y*Xcomp MyArray( x, y) = Rand(100) Color 255,255,255 Text x*30,y*30, MyArray( x,y ) Color 255,0,0 Text x*30,y*30+10,Index Next Next Color 255,255,0 Index = 15 Text 0,230,"X = "+Getx(Index) Text 0,240,"Y = "+Gety(Index) Text 0,250,"Value @ Index "+Index+" : "+MyArray( Getx(Index), Gety(Index ) ) Flip MouseWait ;============================================= ;============================================= ;============================================= Function GetX( Index ) Return ( Index Mod Xcomp ) End Function ;============================================= ;============================================= ;============================================= Function GetY( Index ) Return Floor( Index / Xcomp ) End Function