function [c,ia] = setdiff(a,b,flag)
%SETDIFF Set difference for cell array of strings.
%   SETDIFF(A,B) when A and B are vectors returns the values
%   in A that are not in B. The result will be sorted.
%
%   [C,I] = SETDIFF(A,B) also returns an index vector I such that
%   C = A(I).
%
%   See also UNIQUE, UNION, INTERSECT, SETXOR, ISMEMBER.

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

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

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

[c,ia] = setdiff(char(a),char(b),'rows');
if ischar(a), a = cellstr(a); end
c = reshape(a(ia),size(ia));

if isrow
  c = c';
  ia = ia';
end
  