function a = isdef(w, varargin)
%  1.  NAME
%
%  isdef - Check if a variable is defined
%
%  2.  SYNOPSIS
%
%  a = isdef(w)
%
%  3.  DESCRIPTION
%
%  This function checks if a variable is defined. With higher version of
%  Matlab, it has become obsolete, as one can use the Matlab function
%  exist.
%
%  4.  PARAMETERS
%
%     w  The output of Matlab function who.
%
%     var
%        A string containing the variable name.
%
%  5.  RETURNS
%
%     a  An array with 1 if the corresponding variable is defined,0
%        otherwise.
%
%  6.  AUTHORS
%
%  Pierre Jaccard, Geophysical Institute, University of Bergen, 1999
%

a = [];
l = nargin - 1;

% Loop through the input arguments:
for i=1:l,

  if length(find(strcmp(w, varargin{i}))) > 0,
	 a(i) = 1;
  else
	 a(i) = 0;
  end
  
end

if l == 1,
  a = a(1);
end



