Mercurial > octave
changeset 26178:0a862644da84
stemleaf.m: Put error statements first in input validation.
* stemleaf.m: Put error statements first in input validation.
author | Rik <rik@octave.org> |
---|---|
date | Fri, 07 Dec 2018 11:16:19 -0800 |
parents | f2d795f07c84 |
children | a0b63c183d4b |
files | scripts/plot/draw/stemleaf.m |
diffstat | 1 files changed, 4 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/plot/draw/stemleaf.m Thu Dec 06 22:05:05 2018 -0800 +++ b/scripts/plot/draw/stemleaf.m Fri Dec 07 11:16:19 2018 -0800 @@ -155,12 +155,11 @@ if (nargin == 2) stem_step = 10; else - if (isscalar (stem_sz) && stem_sz >= 0 && isreal (stem_sz)) - stem_sz = fix (stem_sz); - stem_step = 10^(stem_sz+1); - else + if (! (isscalar (stem_sz) && stem_sz >= 0 && isreal (stem_sz))) error ("stemleaf: STEM_SZ must be a real integer >= 0"); endif + stem_sz = fix (stem_sz); + stem_step = 10^(stem_sz+1); endif ## Note that IEEE 754 states that -+ 0 should compare equal. This has @@ -246,7 +245,7 @@ ## Vectorized version provided by Rik Wehbring (rik@octave.org) ## Determine leaves for each stem: new_line = 1; - for kx = 2: numel (stems) + for kx = 2 : numel (stems) stem_sign = signbit (stems(kx)); if (stems(kx) <= 0)