view examples/@polynomial/subsref.m @ 8710:739141cde75a ss-3-1-52

fix typo in Array-f.cc
author Jaroslav Hajek <highegg@gmail.com>
date Mon, 09 Feb 2009 21:51:31 +0100
parents e2a179415bac
children 567e3e4ab74d
line wrap: on
line source

function b = subsref (a, s)
  switch s.type
    case "()"
      ind = s.subs;
      b = polyval (fliplr(a.poly), ind{:});
    case "{}"
      ind = s.subs;
      b = polynomial (a.poly(ind{:}));
    case "."
      fld = s.subs;
      if (strcmp (fld, "poly"))
	b = a.poly;
      else
	error ("@polynomial/subsref: invalid property \"%s\"",
	       fld);
      endif
  endswitch
endfunction