function y=pdeisusd(name)
%PDEISUSED Checks if NAME is already used.
%
%       PDEISUSD(NAME) checks the string NAME against all object names
%       in PDETOOL and returns 1 if NAME is used, 0 if not.
%
%       Note: NAME is case sensitive, e.g., 'E1'~='e1'.

%       Magnus Ringh 11-15-94. MR 8-17-95
%       Copyright (c) 1994-98 by The MathWorks, Inc.
%       $Revision: 1.7 $  $Date: 1997/11/25 17:05:56 $

if ~isstr(name),
  error('Input must be a string');
end

y=0;
pde_fig=findobj(allchild(0),'flat','Tag','PDETool');
objnames=getuprop(pde_fig,'objnames');

[n,m]=size(objnames);
ln=length(name);
if ln>n,
  return;
end
nm=(ones(m,1)*[name zeros(1,n-ln)])';
tst=(nm==objnames);
if any(sum(tst)==size(tst,1)),
  y=1;
end

