]> Creatis software - CreaPhase.git/blob - octave_packages/nan-2.5.5/tiedrank.m
Add a useful package (from Source forge) for octave
[CreaPhase.git] / octave_packages / nan-2.5.5 / tiedrank.m
1 function R=tiedrank(X,DIM)
2 % TIEDRANK compute rank of samples, the mean value is used in case of ties
3 %  this function is just a wrapper for RANKS, and provided for compatibility 
4 %  with the statistics toolbox of matlab(tm)
5
6 %    R = tiedrank(X)
7 %       computes the rank R of vector X
8 %    
9 % see also: RANKS
10
11
12 %       $Id: tiedrank.m 8223 2011-04-20 09:16:06Z schloegl $
13 %       Copyright (C) 2009,2010 by Alois Schloegl <alois.schloegl@gmail.com>    
14 %       This function is part of the NaN-toolbox
15 %       http://pub.ist.ac.at/~schloegl/matlab/NaN/
16
17 %    This program is free software; you can redistribute it and/or modify
18 %    it under the terms of the GNU General Public License as published by
19 %    the Free Software Foundation; either version 3 of the License, or
20 %    (at your option) any later version.
21 %
22 %    This program is distributed in the hope that it will be useful,
23 %    but WITHOUT ANY WARRANTY; without even the implied warranty of
24 %    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
25 %    GNU General Public License for more details.
26 %
27 %    You should have received a copy of the GNU General Public License
28 %    along with this program; If not, see <http://www.gnu.org/licenses/>.
29
30
31 if nargin>1,
32         error('more than 1 input argument is currently not supported ')
33 end;    
34
35 if nargout>1,
36         error('more than 1 output argument is currently not supported ')
37 end;    
38
39 if nargin<2,
40         DIM = [];
41 end;
42 if isempty(DIM),
43         DIM = find(size(X)>1,1);
44         if isempty(DIM), DIM = 1; end;
45 end
46 if (DIM<1), DIM = 1; end; %% Hack, because min([])=0 for FreeMat v3.5
47
48 R = ranks(X,DIM); 
49
50