MATLAB versions prior to R2016b:
>> C = bsxfun(@minus,Q,M)
C =
9 4 11 5 7 5
6 9 9 9 11 7
11 11 15 7 12 4
5 14 6 6 12 9
8 12 8 12 12 9
10 15 13 8 5 13
6 9 7 11 9 8
3 13 14 7 10 5
8 14 6 10 7 11
5 6 17 9 7 8
6 6 11 5 9 5
10 10 10 9 6 7
6 6 11 9 9 5
9 7 12 11 10 10
9 12 7 4 8 8
9 7 8 10 10 10
MATLAB versions R2016b or later:
>> Q-M
ans =
9 4 11 5 7 5
6 9 9 9 11 7
11 11 15 7 12 4
5 14 6 6 12 9
8 12 8 12 12 9
10 15 13 8 5 13
6 9 7 11 9 8
3 13 14 7 10 5
8 14 6 10 7 11
5 6 17 9 7 8
6 6 11 5 9 5
10 10 10 9 6 7
6 6 11 9 9 5
9 7 12 11 10 10
9 12 7 4 8 8
9 7 8 10 10 10