I've got a big array, say A, with values in {1,...,n}, and another array B of the same size.
I want to get all of the following:
B(A==1)
B(A==2)
...
B(A==n)
and then do something else with the results (not so important for now).
I tried things like:
[x,y] = B(A==[1:n])
and
[x,y] = [B(A==1), B(A==2), ..., B(A==n)]
Of course to no avail.
The for loop approach
for ii=1:n
dummy=B(A==1)
other stuff
end
works, but I'm convinced I can avoid for loops for everything in MATLAB! Stuck here, though. Any suggestions? Perhaps some sort of inline anonymous function call?