# HG changeset patch # User Jaroslav Hajek # Date 1244796313 -7200 # Node ID 34f5a466e7cef8a89751e64c8958c7361a12bc1d # Parent ad7a2f55c8b43438e300e22f91559a260d160304 examples/polynomial: properly handle magic colon diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-06-02 Jaroslav Hajek + + * examples/@polynomial/subsref.m: Handle ':' correctly. + * examples/@polynomial/subsasgn.m: Ditto. + 2009-05-22 Benjamin Lindner * mkoctfile.cc.in: mask MSVC specific linker flags for mex output diff --git a/examples/@polynomial/subsasgn.m b/examples/@polynomial/subsasgn.m --- 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 diff --git a/examples/@polynomial/subsref.m b/examples/@polynomial/subsref.m --- 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;