I have matrix A and a vector b, which specifies column index of the element to be extracted for each corresponding row of the matrix.
For example,
A = [1 2 3
4 5 6
7 8 9]
b = [1 3 2]'
I'd like to have c = [1 6 8]'
on output. How to achieve this?
I tried A(:, b)
, but it doesn't work as I need.