comparison examples/code/@polynomial/set.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
comparison
equal deleted inserted replaced
21058:759fcdf3666d 21059:73ab962bc52d
1 function s = set (p, varargin) 1 function s = set (p, varargin)
2 s = p; 2
3 if (length (varargin) < 2 || rem (length (varargin), 2) != 0) 3 if (numel (varargin) < 2 || rem (numel (varargin), 2) != 0)
4 error ("@polynomial/set: expecting property/value pairs"); 4 error ("@polynomial/set: expecting property/value pairs");
5 endif 5 endif
6 while (length (varargin) > 1) 6
7 s = p;
8 while (numel (varargin) > 1)
7 prop = varargin{1}; 9 prop = varargin{1};
8 val = varargin{2}; 10 val = varargin{2};
9 varargin(1:2) = []; 11 varargin(1:2) = [];
10 if (ischar (prop) && strcmp (prop, "poly")) 12 if (! ischar (prop) || ! strcmp (prop, "poly"))
11 if (isvector (val) && isreal (val))
12 s.poly = val(:).';
13 else
14 error ("@polynomial/set: expecting the value to be a real vector");
15 endif
16 else
17 error ("@polynomial/set: invalid property of polynomial class"); 13 error ("@polynomial/set: invalid property of polynomial class");
14 elseif (! (isvector (val) && isreal (val)))
15 error ("@polynomial/set: expecting the value to be a real vector");
18 endif 16 endif
17
18 s.poly = val(:).'; # force row vector
19 endwhile 19 endwhile
20
20 endfunction 21 endfunction