view examples/@polynomial/subsasgn.m @ 9284:567e3e4ab74d

fix up examples/@polynomial
author Robert T. Short <octave@phaselockedsystems.com>
date Sun, 31 May 2009 21:11:31 -0700
parents dba0037e6602
children 226f6d001ee2
line wrap: on
line source

function p = subsasgn (p, index, val)
  index.type
  index.subs
  switch (index.type)
    case "()"
      ind = index.subs;
      if ( (any (ind{:}>length(p.poly)))
        || (any (ind{:}<0)) )
        error ("subsasgn: subscript out of range");
      endif
      p.poly(ind{:}) = val;
    case "."
      fld = index.subs;
      if (strcmp (fld, "poly"))
        p.poly = val;
      else
        error ("@polynomial/subsref: invalid property \"%s\"", fld);
      endif
  endswitch
endfunction