# HG changeset patch # User John W. Eaton # Date 1318518330 14400 # Node ID d6118a2c0644cb362546307b2103e2c8c917aa67 # Parent 348857854c5231edbf122a0a3e128d93b542e8fa fix indexing bug for matrices inside anonymous functions * ov-base-mat.h (octave_base_matrix::do_multi_index_op): New method. * ov-fcn-handle.cc: New test. diff -r 348857854c52 -r d6118a2c0644 src/ov-base-mat.h --- a/src/ov-base-mat.h Wed Oct 12 22:25:01 2011 -0400 +++ b/src/ov-base-mat.h Thu Oct 13 11:05:30 2011 -0400 @@ -89,6 +89,9 @@ octave_value do_index_op (const octave_value_list& idx, bool resize_ok = false); + octave_value_list do_multi_index_op (int, const octave_value_list& idx) + { return do_index_op (idx); } + void assign (const octave_value_list& idx, const MT& rhs); void assign (const octave_value_list& idx, typename MT::element_type rhs); diff -r 348857854c52 -r d6118a2c0644 src/ov-fcn-handle.cc --- a/src/ov-fcn-handle.cc Wed Oct 12 22:25:01 2011 -0400 +++ b/src/ov-fcn-handle.cc Thu Oct 13 11:05:30 2011 -0400 @@ -1956,3 +1956,12 @@ return retval; } + +/* +%!function r = f (g, i) +%! r = g(i); +%!endfunction +%!test +%! x = [1,2;3,4]; +%! assert (f (@(i) x(:,i), 1), [1;3]); +*/