comparison scripts/statistics/base/range.m @ 9160:11e0f0e8ff00

fix range
author Jaroslav Hajek <highegg@gmail.com>
date Thu, 30 Apr 2009 20:52:07 +0200
parents a1dbe9d80eee
children 5fb7e17281e8
comparison
equal deleted inserted replaced
9159:c07cbffb82e3 9160:11e0f0e8ff00
1 ## Copyright (C) 1995, 1996, 1997, 1998, 2000, 2002, 2004, 2005, 2006, 1 ## Copyright (C) 1995, 1996, 1997, 1998, 2000, 2002, 2004, 2005, 2006,
2 ## 2007 Kurt Hornik 2 ## 2007 Kurt Hornik
3 ## Copyright (C) 2009 Jaroslav Hajek
3 ## 4 ##
4 ## This file is part of Octave. 5 ## This file is part of Octave.
5 ## 6 ##
6 ## Octave is free software; you can redistribute it and/or modify it 7 ## Octave is free software; you can redistribute it and/or modify it
7 ## under the terms of the GNU General Public License as published by 8 ## under the terms of the GNU General Public License as published by
30 ## @end deftypefn 31 ## @end deftypefn
31 32
32 ## Author: KH <Kurt.Hornik@wu-wien.ac.at> 33 ## Author: KH <Kurt.Hornik@wu-wien.ac.at>
33 ## Description: Compute range 34 ## Description: Compute range
34 35
35 function y = range (x, varargin) 36 function y = range (x, dim)
36 37
37 if (nargin != 1 && nargin != 2) 38 if (nargin == 1)
39 y = max (x) - min (x);
40 elseif (nargin == 2)
41 y = max (x, dim) - min (x, dim);
42 else
38 print_usage (); 43 print_usage ();
39 endif 44 endif
40 45
41 y = max (x, varargin{:}) - min (x, varargin{:});
42
43 endfunction 46 endfunction