Works very fast ,THX Paul
W dniu czwartek, 4 grudnia 2014 19:03:07 UTC+1 użytkownik Steven G. Johnson napisał: > > It sounds like you have an array J and you want to map each element of J > to a unique integer in 1:N for N as small as possible? This will do it: > > d = (Int=>eltype(J))[j => i for (i,j) in enumerate(unique(J))] > > Jcodes = [d[j] for j in J] > > Here, d is a dictionary mapping integers in 1:N to the corresponding > values in J, and Jcodes is the "re-coded" array. >