[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Behavior of lookup() on cell array of strings wrong?

From: murphstein
Subject: Behavior of lookup() on cell array of strings wrong?
Date: Wed, 12 Jul 2017 10:00:06 -0700 (PDT)

>From the docs, I expect that if table T is a sorted cell array of short
strings, such that isequal(T, sort(T)) returns true, and Y is short string
NOT in T, then I = lookup(T, Y) should return zero (not found).  Instead,
I'm getting back index N, which corresponds to the string that would have
followed Y in the sorted list, had Y been present.  

Am I missing an option, misunderstanding lookup(), or encountering a
behavioral issue in Octave?  I would really rather not have to do a
strcmp(Y, T{IDX}) after every lookup() to make sure I've got a valid index.

Running Octave 4.2.1, installed by HomeBrew , on OSX 10.11.6 (El Capitan).


Dan Murphy, address@hidden
"History is made at night. Character is what you are in the dark."
View this message in context:
Sent from the Octave - General mailing list archive at

reply via email to

[Prev in Thread] Current Thread [Next in Thread]