function [b,ndx,pos] = unique(a,flag)
%UNIQUE Set unique for cell array of strings.
%   UNIQUE(A) for the cell vector A returns the same strings as in A but
%   with no repetitions.  A will be also be sorted.
%
%   [B,I,J] = UNIQUE(A) also returns index vectors I and J such
%   that B = A(I) and A = B(J) (or B = A(I,:) and A = B(J,:)).
%   
%   See also UNION, INTERSECT, SETDIFF, SETXOR, ISMEMBER.

%   Copyright (c) 1984-98 by The MathWorks, Inc.
%   $Revision: 1.5 $  $Date: 1998/05/20 15:22:41 $

if nargin>1, error('''rows'' flag not supported for cell arrays.'); end

isrow = ndims(a)==2 & size(a,1)==1;

[b,ndx,pos] = unique(char(a),'rows');
b = reshape(a(ndx),size(ndx));

if isrow
  b = b'; 
  ndx = ndx';
  pos = pos';
end



