Let’s say you have the following image:

im(:,:,1) = [8 1 6; 3 5 7; 4 9 2]
im(:,:,2) = [9 2 7; 4 6 8; 5 10 3]
im(:,:,3) = [10 3 8; 5 7 9; 6 11 4]

and you want the pixels im(1,1), im(2,3), im(3,4). So the vector of subscripts will be:

p_sub = [1 1; 2 3; 3 3];

To convert those subscripts to index run

p_index = sub2ind(size(a),p_sub(:,1),p_sub(:,2));

You can run the following code to get the result:

im = reshape(im(:),[],3);

Now the image has N lines (N is the number of pixels of the original image) by 3 columns (R,G,B). To get the pixels you wanted now you only have to run this:

im(p_index,:)

The result will be

ans =

   8    9   10
   7    8    9
   2    3    4