0001 function [t, errorstr] = isatelem(ELEM,varargin)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 errorstr = [];
0018
0019 if ~isstruct(ELEM)
0020 errorstr = [errorstr,sprintf('%s\n','Input is not a MATLAB structure')];
0021 else
0022 if ~isfield(ELEM,'PassMethod');
0023 errorstr = [errorstr,sprintf('%s\n','Required field ''PassMethod'' is missing')];
0024 else
0025 EXISTRESULT = exist(ELEM.PassMethod);
0026 if EXISTRESULT == 3
0027
0028
0029 try
0030 temp = feval(ELEM.PassMethod,ELEM, [0 0 0 0 0 0]');
0031
0032 catch
0033 errorstr = [errorstr,sprintf('%s\n',['Specified PassMethod m-file: ''',...
0034 (ELEM.PassMethod), ''' returned an error'])];
0035 end
0036
0037 ReqFields = feval(ELEM.PassMethod);
0038
0039 for field = 1:length(ReqFields)
0040 if ~isfield(ELEM,ReqFields{field})
0041 errorstr = [errorstr,sprintf('%s\n',['Required field ''',ReqFields{field}...
0042 ,''' is missing'])];
0043 end
0044 end
0045
0046
0047
0048 elseif EXISTRESULT == 2
0049
0050
0051 try
0052 temp = feval(ELEM.PassMethod,ELEM, [0 0 0 0 0 0]');
0053
0054 catch
0055 errorstr = [errorstr,sprintf('%s\n',['Specified PassMethod m-file: ''',...
0056 (ELEM.PassMethod), ''' returned an error'])];
0057 end
0058
0059 else
0060 errorstr = [errorstr,sprintf('%s\n',['Specified PassMethod mex-file or m-file: ''',...
0061 (ELEM.PassMethod), '.',mexext,''' does not exist'])];
0062 end
0063 end
0064
0065 end
0066
0067
0068 if isempty(errorstr)
0069 t = 1;
0070 else
0071 t = 0;
0072 end
0073
0074 if any(strncmpi(varargin,'disp',4))
0075 disp(errorstr);
0076 end