Mercurial > hg > octave-lojdl
changeset 9344:0c4e6a3d6e3e
support char arrays in lookup
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Sun, 14 Jun 2009 11:32:25 +0200 |
parents | 70e0d3b1f26f |
children | dbc61d4e428d |
files | src/ChangeLog src/DLD-FUNCTIONS/lookup.cc |
diffstat | 2 files changed, 11 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2009-06-14 Jaroslav Hajek <highegg@gmail.com> + + * DLD-FUNCTIONS/lookup.cc (Flookup): Support character array lookup. + 2009-06-12 John W. Eaton <jwe@octave.org> * ov-fcn-handle.cc (make_fcn_handle): Accept operators which have
--- a/src/DLD-FUNCTIONS/lookup.cc +++ b/src/DLD-FUNCTIONS/lookup.cc @@ -186,7 +186,8 @@ if (table.ndims () > 2 || (table.columns () > 1 && table.rows () > 1)) warning ("lookup: table is not a vector"); - bool num_case = table.is_numeric_type () && y.is_numeric_type (); + bool num_case = ((table.is_numeric_type () && y.is_numeric_type ()) + || (table.is_char_matrix () && y.is_char_matrix ())); bool str_case = table.is_cellstr () && (y.is_string () || y.is_cellstr ()); bool left_inf = false; bool right_inf = false; @@ -239,6 +240,11 @@ else if INT_ARRAY_LOOKUP (uint16) else if INT_ARRAY_LOOKUP (uint32) else if INT_ARRAY_LOOKUP (uint64) + else if (table.is_char_matrix () && y.is_char_matrix ()) + retval = do_numeric_lookup (table.char_array_value (), + y.char_array_value (), + left_inf, right_inf, + match_idx, match_bool); else if (table.is_single_type () || y.is_single_type ()) retval = do_numeric_lookup (table.float_array_value (), y.float_array_value (),