At first I would like to display an empty graph spaced by 2. For this purpose both axes have value from 0 to 10 stepped by 2.
After generating the axes, set the XTick and YTick to 0:2:10.
Secondly, I would like to associate to each subgrid to a square polygon let's assume P1=(0,0) P2=(2,0) P3=(0,2) P4=(2,2).
I interpret this as I would like to add a polygon to the axes. If the polygon is rectangular and parallel to the axes use
where L and B are the (x,y) coordinates for the left, bottom corner and W and H are width and height.
Otherwise you can use polyshape or patch.
At this point I would like to check for whichever point in the space if they belong or not to this polygon.
If yes, I need to save in a cell/table all information related to the point namely X and Y coordinates and timestamp.
Use the outputs of inpolygon in a conditional statement. Set up a table that has a column for the variables you listed above and add values to the table as needed.
If you get stuck on any of the steps above, share your updated code and point out the problem so we can help get you unstuck.