% Returns column vectors where each component is -1 except for the
% ones whose respective component in original columns was the
% biggest..  If there is only one dimension, this will round the
% values to -1 or 1, whichever is closest.

function binary = class_compete(columns)

if size(columns,1)==1
  binary = -1 + 2*(columns >= 0);
  return
end

[dummy, I] = max(columns);
binary = -1 * ones(size(columns));
for col = 1:size(binary,2)
  binary(I(col),col) = 1;
end
