sparse to the rescue!
Let your data and the desired range be defined as
A = [ 205 204 201 202 208 202 ]; %// data. Two-row matrix limits = [200 208]; %// desired range. It needn't include all values of A
Then
lim1 = limits(1)-1; s = limits(2)-lim1; cols = all((A>=limits(1)) & (A<=limits(2)), 1); B = sort(A(:,cols), 1, 'descend')-lim1; R = full(sparse(B(2,:), B(1,:), 1, s, s));
gives
R = 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Alternatively, you can opt out of sort and use the addition of a matrix followed by triu to get the same result (possibly faster):
lim1 = limits(1)-1; s = limits(2)-lim1; cols = all( (A>=limits(1)) & (A<=limits(2)) , 1); R = full(sparse(A(2,cols)-lim1, A(1,cols)-lim1, 1, s, s)); R = triu(R + R.');
Both approaches handle repeating columns (up to sorting), correctly increasing their number. For instance,
A = [205 204 201 201 208 205]
gives
R = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0