# HG changeset patch # User Jaroslav Hajek # Date 1244716624 -7200 # Node ID bf6da2fbfa4e05ea788082f76cd0219941b89f24 # Parent a76f391a3d02a319be3baf22b31e219fcbe14cf1 examples/polynomial: properly handle magic colon diff -r a76f391a3d02 -r bf6da2fbfa4e ChangeLog --- a/ChangeLog Thu Jun 11 12:25:36 2009 +0200 +++ b/ChangeLog Thu Jun 11 12:37:04 2009 +0200 @@ -1,3 +1,8 @@ +2009-06-02 Jaroslav Hajek + + * examples/@polynomial/subsref.m: Handle ':' correctly. + * examples/@polynomial/subsasgn.m: Ditto. + 2009-06-11 Jaroslav Hajek * example/@polynomial/numel.m: New method. diff -r a76f391a3d02 -r bf6da2fbfa4e examples/@polynomial/subsasgn.m --- a/examples/@polynomial/subsasgn.m Thu Jun 11 12:25:36 2009 +0200 +++ b/examples/@polynomial/subsasgn.m Thu Jun 11 12:37:04 2009 +0200 @@ -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 diff -r a76f391a3d02 -r bf6da2fbfa4e examples/@polynomial/subsref.m --- a/examples/@polynomial/subsref.m Thu Jun 11 12:25:36 2009 +0200 +++ b/examples/@polynomial/subsref.m Thu Jun 11 12:37:04 2009 +0200 @@ -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;