"Roger Stafford" wrote in message <ir976m$eqp$1@newscl01ah.mathworks.com>...
> "AJP" wrote in message <ir94ps$98l$1@newscl01ah.mathworks.com>...
> > .......
> > For each unique (x,y) in A, I want to test the column 3 elements in B to see whether they are above or below the true value in the third column of A. I then want to return a column vector of logicals length(B) with 0 if it is below and 1 if it is above. .....
> > .......
>          
> [~,loc] = ismember(B(:,1:2),A(:,1:2));
> T = B(:,3) > A(loc,3); % < This is your logical vector
>
> This assumes that every pair in the first two columns of B will be found somewhere in those of A, and also that every pair in A is unique.
>
> Roger Stafford
Thanks for your input Roger.
"loc" appears to be a 2xlength(B) matrix, therefore A(loc,3) does not work. Maybe a small correction is required?
Here's what I had come up with so far using a for loop (sort of in debug mode, returning lots of checkabe stuff...)
for n=1:length(A)
ind1=ismember(B(:,1:2),A(:,1:2),'rows')
B(ind1,:)
ind2=B(ind1,3)>A(n,3)
end
ind1 is a column vector length B and identifies the rows where there is a match in the coordinates.
ind2 is a column vector of length 2 (in this case) and identifies which of these rows are abve or below the true value.
Now if I can just unite the two pieces of info in ind1 and ind2 I'll have done it. But I don't know how to do it! :D
