output = accumarray(XY_indx(:,1:2), XY_indx(:,3), [], @(V) {V})
output =
{2×1 double} {3×1 double}
{3×1 double} {[ 4]}
Notice that some of your groups have more than 2 entries.
This works only if the indices are positive integers, and it does not work well if the indices have large gaps (you get empty cells).
There are variations for the times those are problems:
[urow, ~, G] = unique(XY_indx(:,1:2), 'rows');
grouped = accumarray(G, XY_indx(:,3), [], @(V) {V.'});
output = [num2cell(urow,2), grouped]
output =
{1×2 double} {1×2 double}
{1×2 double} {1×3 double}
{1×2 double} {1×3 double}
{1×2 double} {[ 4]}
Here, the first column of the cell gives the coordinates such as [2 1] that the second column of the cell refers to. The second column of the cell lists the entries such as [2, 6, 10]