I have read through the examples here, but it does not seem to include the following case.
Let A be a three dimensional array with dimensions 128 x 128 x 3.
I want to pick sets of 3 integers at random from this array, by picking random pairs for the first two dimensions. This is my current attempt:
rng(1);
choicex = randi(128, 1, 16)
choicey = randi(128, 1, 16)
random_values = A(choicex, choicey,:)
Unfortunately, this the matrix random_values is now 16 x 16 x 3, when I want it to be 16 x 3.
Taking one slice of this does not work because then either all the first indices would be the same or all the second indices would be the same.
I do not require that random_values carries the original indices.
Is there any way to achieve this in matlab directly with index notation, without writing a for loop?
Per the given answer, I have updated the question.