Hi,
The following code will return the required index .
flag = 0;
val = find(A == 3,1); % finding the index of first occurrence of 3
for i = val+1 : size(A,1)
if A(i)== 2 % checking if the element is 2
flag = 1;
break;
end
end
if flag
index = i; % first occurrence of ‘2’ after a ‘3’ occurred
end
If flag is 0 then the element is not present in the array.