MATLAB: How to calculate differences in one column for specific pairs of rows (whose index are listed in another matrix)

aquivalent to vlookuppairs of rowsrow indeces

I've got a matrix A with two columns (mx2). Each row is a pair of row indices for another matrix B.
e.g. A = [1 3 ; 5 8 ; 11 15 ; … ] means that row 1 and 3 of matrix B are one pair.
I need to calculate the difference in column 11 of matrix B for all pairs of rows given in A. Any ideas?

Best Answer

"Deadahead" solution...
for i=1:size(A,1)
D(i)=B(A(i,2),11)-B(A(i,1),11);
end