function [ corr ] = GetPair( X, corr,points_num, label_num, maxpoints )
%% get the max value and calculate the pairs


loop_times = min(points_num,label_num*maxpoints);
for i = 1 : loop_times
    max_position = find(X==max(X));
    X(max_position) = 0;
    label_index = mod(max_position,label_num);
    if label_index == 0
        label_index = label_num;
    end
    point_index = ceil(max_position/label_num);
    corr(point_index) = label_index;

%     % set some positions to 0
%     for j = (point_index - 1)* label_num + 1 : point_index * label_num
%         X(j) = 0;
%     end
% 
%     % set some position to 0 again
%     for k = 1 : points_num * label_num
%         if mod(k,points_num) == label_index
%             X(k) = 0;
%         end
%     end
end

end

