function val=chkstruct(s,field,el)
% chkcell  Return s.field{el} or s.field(el) if s is structure else returns ''.
% Usage:: val=chkstruct(s,field,el)
%
% Return s.field{el} or s.field(el) if s is structure else returns ''.  If
% el is omitted returns s.field

% revision history:
% 08/02/02 Mark D. Shattuck <mds>   chkstruct.m
% 08/06/02 mds  Add option for no el.

if(nargin==2)
  if(isfield(s,field))
    val=s.(field);
  else
    val='';
  end
else
  if(isfield(s,field))
    if(iscell(s.(field)))
      val=s.(field){el};
    else
      val=s.(field)(el);
    end
  else
    val='';
  end
end