function [ i ] = index( x, v )
%INDEX returns the first i, such that x[i]==v or 0 if no such i exists.
L = length(x);
found = 0;
for i=1:L,
    if x(i) == v
        found = 1;
        break;
    end
end
if found==0
    i = 0;
end