I have the following table:
n = 3;
myTab = Flatten[Table[{i, j}, {i, -1, n}, {j, -1, n}], 1]
(*output:
{{-1,-1},{-1,0},{-1,1},{-1,2},{-1,3},{0,-1},{0,0},{0,1},{0,2},{0,3},
{1,-1},{1,0},{1,1},{1,2},{1,3},{2,-1},{2,0},{2,1},{2,2},{2,3},{3,-1},
{3,0},{3,1},{3,2},{3,3}}
*)
Now from myTab
, I only want to select those elements {i,j}
that matches the pattern {i,i+1}
or {n,i}
. What is the best way to achieve that in Mathematica? Any help is much appreciated!