From: Pr B on
i should also note that the values in column 2 of arrays A and B are not unique and are not sorted in ascending order.
From: Jan Simon on
Dear Pr B!

> for i = 1:length(x)
> count = 0;
> for j = 1:n
> if data1(j) == x(i)
> count = count+1;
> end
> end
> percent=[percent;[count/n,x(i)]];
> end

If you see, that the IF line is buggy, why don't you change it before posting it repeatedly?
"if data1(j) == x(i)" looks in each element of data1. But you want to count only these elements, which have a certain value in the 1st column. So just add this condition!

Nevertheless, I'd use ISMEMBER instead:
x = unique(B(:,1));
percent(:, 2) = transpose(1:length(x))
for i = 1:length(x)
InA = (A(:, 1) == x(i));
InB = (B(:, 1) == x(i));
percent(i, 1) = [sum(ismember(A(InA, 2), B(InB, 2))) / sum(InA)];
end

I admit, I'm still confused by the poblem description. It could be:
[sum(ismember(B(InB, 2), A(InA, 2))) / sum(InA)]
Please try if one of these lines match your question.

Good luck, Jan