A = rand(50,50);
X = [1 2 5]; % Assuming These Are The Row Indices
Y = [1 2 5]; % Assuming These Are The Column Indices
I = sub2ind(size(A), X, Y)
P = A(I)
Check = [A(X(1),Y(1)), A(X(2),Y(2)), A(X(3),Y(3))]
If you want a different result, please describe it in some detail.
.