I am using Matlab to do one of my projects. I am stuck at one basic thing.
I have 2 matricies – A and B and a vector V. What I want to do is this:
A(i, j) = V(B(i,j)) for all i, j.
I tried doing this in the most obvious way – nested loops. For some reason, A is not getting populated. Am I missing something? Is there a more efficient (in-built function) way of doing this.
Thanks,
Anil.
If all entries in
Bare integers larger than zero, and if the maximum ofBis not larger than the number of elements inV, then you can simply write