[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Wrong indices returned using Lookup for cells containing strings
From: |
Francesco Potortì |
Subject: |
Re: Wrong indices returned using Lookup for cells containing strings |
Date: |
Wed, 21 Oct 2015 14:34:23 +0200 |
>> Yes. When doing lookup(TABLE, Y), TABLE must be sorted. This is not
>> clear from the docs, I filed a bug report.
>>
>
>Hmm, then why did I get the same output for
>
>>> lookup(a,b)
>
>And
>
>>> lookup(sort(a),b)
Chance. I assume that the lookup algorithm is not defined for unsorted
input, and does not check for a sorted table for efficiency reasons.
Look at this:
>> lookup([1 2 3 4 5 6 7 8 9], [3 5])
ans =
3 5
>> lookup([1 2 6 7 5 8 9 3 4], [3 5])
ans =
2 9
>> lookup({"1" "2" "3" "4" "5" "6" "7" "8" "9"}, {"3" "5"})
ans =
3 5
>> lookup({"1" "2" "6" "7" "5" "8" "9" "3" "4"}, {"3" "5"})
ans =
2 9
>>
--
Francesco Potortì (ricercatore) Voice: +39.050.621.3058
ISTI - Area della ricerca CNR Mobile: +39.348.8283.107
via G. Moruzzi 1, I-56124 Pisa Skype: wnlabisti
(entrance 20, 1st floor, room C71) Web: http://fly.isti.cnr.it
- Re: Wrong indices returned using Lookup for cells containing strings, (continued)
- Re: Wrong indices returned using Lookup for cells containing strings, Olaf Till, 2015/10/20
- Re: Wrong indices returned using Lookup for cells containing strings, Nicholas Jankowski, 2015/10/20
- Re: Wrong indices returned using Lookup for cells containing strings, Olaf Till, 2015/10/20
- Re: Wrong indices returned using Lookup for cells containing strings, Nicholas Jankowski, 2015/10/20
- Re: Wrong indices returned using Lookup for cells containing strings, Nicholas Jankowski, 2015/10/20
- Re: Wrong indices returned using Lookup for cells containing strings, rcharan51, 2015/10/21
- Re: Wrong indices returned using Lookup for cells containing strings, Francesco Potortì, 2015/10/21
- Re: Wrong indices returned using Lookup for cells containing strings, Nicholas Jankowski, 2015/10/21
- Re: Wrong indices returned using Lookup for cells containing strings, Mike Miller, 2015/10/21
- Re: Wrong indices returned using Lookup for cells containing strings, Olaf Till, 2015/10/21
- Re: Wrong indices returned using Lookup for cells containing strings,
Francesco Potortì <=