Mercurial > hg > octave-lyh
changeset 11988:34f5a466e7ce release-3-2-x
examples/polynomial: properly handle magic colon
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Fri, 12 Jun 2009 10:45:13 +0200 |
parents | ad7a2f55c8b4 |
children | 00c8df6335ff |
files | ChangeLog examples/@polynomial/subsasgn.m examples/@polynomial/subsref.m |
diffstat | 3 files changed, 15 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-06-02 Jaroslav Hajek <highegg@gmail.com> + + * examples/@polynomial/subsref.m: Handle ':' correctly. + * examples/@polynomial/subsasgn.m: Ditto. + 2009-05-22 Benjamin Lindner <lindnerb@users.sourceforge.net> * mkoctfile.cc.in: mask MSVC specific linker flags for mex output
--- a/examples/@polynomial/subsasgn.m +++ b/examples/@polynomial/subsasgn.m @@ -9,7 +9,11 @@ error ("polynomial: need exactly one index"); else if (length (s) == 1) - p.poly(ind{1}+1) = val; + if (isnumeric (ind{1})) + p.poly(ind{1}+1) = val; + else + p.poly(ind{1}) = val; + endif else error ("polynomial: chained subscripts not allowed for {}"); endif
--- a/examples/@polynomial/subsref.m +++ b/examples/@polynomial/subsref.m @@ -15,7 +15,11 @@ if (numel (ind) != 1) error ("polynomial: need exactly one index"); else - b = a.poly(ind{1}+1); + if (isnumeric (ind{1})) + b = a.poly(ind{1}+1); + else + b = a.poly(ind{1}); + endif endif case "." fld = s.subs;