Anders <vebihl@gmail.com> wrote in message <32576327.29258.1240905816232.JavaMail.jakarta@nitrogen.mathforum.org>...
> I have a 72x2x64 array where the cells represent: radius x [x y] x angle. Meaning, I have datapoints for 64 angles, 72 radius's and eachdata point consists of a x and y coordinate.
> Now, I want to be able to query a pair of coordinates, and get all the angles and radius's which matches a pair of (x, y).
>
> I tried something like this: indices = find(data(:,1,:) == x & data(:,2,:) == y); but it only returns the element index in the matrix (like [4057, 4058, 5678, 5679]), and not something like: (angel = [34, 42], radius = [2, 55]) which is what i want.

Though I am unable to try it out directly, I think that matlab will regard the expression
data(:,1,:)==x&data(:,2,:)==y
where x and y are scalars, as a twodimensional matrix of logical elements, in which case you can use the twooutputargument form of 'find'
[I,K] = find(data(:,1,:)==x&data(:,2,:)==y);
I and K would then contain the desired subscripts into the corresponding radii and angles.
If that doesn't work, you can use ind2sub appropriately to make the necessary conversion to these subscripts.
Roger Stafford
