MATLAB: Obtain data using columns data indices

columnsrows

i have data A=( 3,5,3,1,4 ) in a column and
B=[ 4 6 9 1 3
2 7 2 5 7
7 3 1 8 2
4 1 6 9 1
2 5 8 3 6]
and i want: as in A first element is 3 and for this i want to get first element of column 3 row 1 from B which is 9. The second element of A is 5 and for this i want to get the the 2nd element of column 5 and row 2 from B which is 7 ,and do the process for all other elements . how to do this? the requried elememts are bold and underlined
any help will be really appriciated………thanks in advance

Best Answer

B(sub2ind( size(B), 1:length(A), A))