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 1984-2000 The MathWorks, Inc. 
%   $Revision: 1.7 $  $Date: 2000/06/01 04:39:41 $

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

isrow = ~((size(a,1)>1 & size(b,2)<=1) | (size(b,1)>1 & size(a,2)<=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
  