A =
3 2 5 6
5 2 1 8
4 2 7 9
>> diff(A,1,1)
ans =
2 0 -4 2
-1 0 6 1
>> diff(A,1,2)
ans =
-1 3 1
-3 -1 7
-2 5 2
>> diff(A,2,1)
ans =
-3 0 10 -1
>> diff(A,2,2)
ans =
4 -2
2 8
7 -3