Mercurial > hg > octave-nkf
changeset 10400:b14fd5116c29
Ensure that 'limits' is a 2 or 4 vector, and that 'fn' is a function
author | Soren Hauberg <hauberg@gmail.com> |
---|---|
date | Fri, 05 Mar 2010 14:29:47 -0800 |
parents | 81bcdf5fd7a9 |
children | 6d1e49abf95f |
files | scripts/ChangeLog scripts/plot/fplot.m |
diffstat | 2 files changed, 13 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,8 @@ +2010-03-05 Soren Hauberg <hauberg@gmail.com> + + * plot/fplot.m: Ensure that 'limits' is a 2 or 4 vector, and that 'fn' is a + function. + 2010-03-05 Jaroslav Hajek <highegg@gmail.com> * testfun/test.m: Support catching warnings and errors by IDs.
--- a/scripts/plot/fplot.m +++ b/scripts/plot/fplot.m @@ -46,6 +46,10 @@ print_usage (); endif + if (!isreal (limits) || (numel (limits) != 2 && numel (limits) != 4)) + error ("fplot: second input argument must be a real vector with 2 or 4 elements"); + endif + if (nargin < 3) n = 0.002; endif @@ -68,9 +72,11 @@ nam = func2str (fn); elseif (all (isalnum (fn))) nam = fn; + elseif (ischar (fn)) + fn = vectorize (inline (fn)); + nam = formula (fn); else - fn = vectorize (inline (fn)); - nam = formula (fn); + error ("fplot: first input argument must be a function handle, inline function or string"); endif if (floor(n) != n)