Is this what you're trying to do?
A=rand(20,1);
B=rand(20,1);
for i=1:1:10
if A(i) < B(i) && A(i+1) > B(i+1)
number = i;
break; % Did you intend to stop when condition was satified?
end
end
% Presumably you wanted to display the stored index
% (although since we now break i and number will be the same)
disp(number)
BTW, Best to post code that can be run in your question. Makes it easier for people answering to see the problem.