diff examples/code/@polynomial/polynomial.m @ 21059:73ab962bc52d

doc: Use newer coding conventions in examples/code directory. * FIRfilter.m, FIRfilter_aggregation.m, display.m, subsasgn.m, subsref.m, display.m, end.m, get.m, numel.m, plot.m, polynomial.m, polynomial_superiorto.m, polyval.m, roots.m, set.m, subsasgn.m, subsref.m, celldemo.cc, fortrandemo.cc, funcdemo.cc, globaldemo.cc, oct_demo.cc, paramdemo.cc, stringdemo.cc: Use newer coding conventions in examples/code directory.
author Rik <rik@octave.org>
date Wed, 13 Jan 2016 16:21:24 -0800
parents 25d676f9619c
children fd97ed44f2da
line wrap: on
line diff
--- a/examples/code/@polynomial/polynomial.m	Wed Jan 13 17:28:42 2016 +1100
+++ b/examples/code/@polynomial/polynomial.m	Wed Jan 13 16:21:24 2016 -0800
@@ -12,19 +12,23 @@
 ## @end deftypefn
 
 function p = polynomial (a)
+
+  if (nargin > 1)
+    print_usage ();
+  endif
+
   if (nargin == 0)
     p.poly = [0];
     p = class (p, "polynomial");
-  elseif (nargin == 1)
+  else
     if (strcmp (class (a), "polynomial"))
       p = a;
     elseif (isvector (a) && isreal (a))
-      p.poly = a(:).';
+      p.poly = a(:).';  # force row vector
       p = class (p, "polynomial");
     else
       error ("@polynomial: expecting real vector");
     endif
-  else
-    print_usage ();
   endif
+
 endfunction