Mercurial > hg > octave-lyh
diff scripts/set/create_set.m @ 3597:26662775f4e9
[project @ 2000-02-12 02:24:41 by jwe]
author | jwe |
---|---|
date | Sat, 12 Feb 2000 02:24:46 +0000 |
parents | e031284eea27 |
children | e6d0041aedf3 |
line wrap: on
line diff
--- a/scripts/set/create_set.m +++ b/scripts/set/create_set.m @@ -39,26 +39,13 @@ usage ("create_set(x)"); endif - if(isempty(x)) + if (isempty(x)) y = []; else - [nrx, ncx] = size(x); - nelx = nrx*ncx; - x = reshape(x,1,nelx); - y = zeros(1,nelx); - - x = sort(x); - cur_val = y(1) = x(1); - yindex = xindex = 2; - - while (xindex <= nelx) - if(cur_val != x(xindex)) - cur_val = x(xindex); - y(yindex++) = cur_val; - endif - xindex++; - endwhile - y = y(1:(yindex-1)); + [nrx, ncx] = size (x); + nelx = nrx * ncx; + y = sort (reshape (x, 1, nelx)); + y = y ([1, (find (y(1:nelx-1) != y(2:nelx)) + 1)]); endif endfunction