Guest User

Untitled

a guest
Jan 17th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.12 KB | None | 0 0
  1. A = [1,2;1,4;5,2]
  2. B = [2;2;1]
  3.  
  4. out = [2;4;5]
  5.  
  6. idx = sub2ind(size(A), 1:size(A, 1), B');
  7. A(idx)
  8.  
  9. ans =
  10.  
  11. 2 4 5
Add Comment
Please, Sign In to add comment