diff examples/@polynomial/subsref.m @ 9332:bf6da2fbfa4e

examples/polynomial: properly handle magic colon
author Jaroslav Hajek <highegg@gmail.com>
date Thu, 11 Jun 2009 12:37:04 +0200
parents 226f6d001ee2
children
line wrap: on
line diff
--- 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;