Mercurial > hg > octave-nkf
comparison scripts/general/is_duplicate_entry.m @ 4862:a0997c4d1d54
[project @ 2004-04-15 21:14:43 by jwe]
author | jwe |
---|---|
date | Thu, 15 Apr 2004 21:14:44 +0000 |
parents | 22bd65326ec1 |
children | 4c8a2e4e0717 |
comparison
equal
deleted
inserted
replaced
4861:fbb15372830c | 4862:a0997c4d1d54 |
---|---|
27 | 27 |
28 function retval = is_duplicate_entry (x) | 28 function retval = is_duplicate_entry (x) |
29 | 29 |
30 if (nargin == 1) | 30 if (nargin == 1) |
31 if (ismatrix (x)) | 31 if (ismatrix (x)) |
32 [m, n] = size (x); | 32 lx = numel (x); |
33 lx = m*n; | |
34 lx1 = lx-1; | 33 lx1 = lx-1; |
35 x = sort (reshape (x, 1, lx)); | 34 x = sort (reshape (x, 1, lx)); |
36 dx = x(1:lx1) - x(2:lx); | 35 dx = x(1:lx1) - x(2:lx); |
37 retval = sum (dx == 0); | 36 retval = sum (dx == 0); |
38 else | 37 else |