ISPROP tests if the given field is one of the object properties. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: ISPROP tests if the given field is one of the object properties. CALL: obj.isprop('field'); isprop(obj, 'field'); INPUTS: obj - Input objects field - Property name of the object M-FILE INFO: Get information about this methods by calling >> ao.getInfo('isprop') Get information about a specified set-plist by calling: >> ao.getInfo('isprop', 'set') VERSION: $Id: isprop.m,v 1.2 2008/09/04 15:29:30 ingo Exp $ HISTORY: 25-09-07 M Hewitson Creation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 % ISPROP tests if the given field is one of the object properties. 0002 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0003 % 0004 % DESCRIPTION: ISPROP tests if the given field is one of the object properties. 0005 % 0006 % CALL: obj.isprop('field'); 0007 % isprop(obj, 'field'); 0008 % 0009 % INPUTS: obj - Input objects 0010 % field - Property name of the object 0011 % 0012 % M-FILE INFO: Get information about this methods by calling 0013 % >> ao.getInfo('isprop') 0014 % 0015 % Get information about a specified set-plist by calling: 0016 % >> ao.getInfo('isprop', 'set') 0017 % 0018 % VERSION: $Id: isprop.m,v 1.2 2008/09/04 15:29:30 ingo Exp $ 0019 % 0020 % HISTORY: 25-09-07 M Hewitson 0021 % Creation 0022 % 0023 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0024 0025 function varargout = isprop(varargin) 0026 0027 %%% Check if this is a call for parameters 0028 if utils.helper.isinfocall(varargin{:}) 0029 varargout{1} = getInfo(varargin{3}); 0030 return 0031 end 0032 0033 %%% Collect input variable names 0034 in_names = cell(size(varargin)); 0035 for ii = 1:nargin,in_names{ii} = inputname(ii);end 0036 0037 %%% Collect all objects 0038 [objs, invars, rest] = utils.helper.collect_objects(varargin(:), '', in_names); 0039 0040 %%% If we eliminated the objects and plists then is the rest the property name 0041 if length(rest) == 1 0042 field = rest{1}; 0043 else 0044 error('### Please specify [only one] field-name.') 0045 end 0046 0047 res = zeros(size(objs)); 0048 try 0049 dummy = objs(1).(field); 0050 res(:) = 1; 0051 varargout{ii} = res; 0052 catch 0053 res(:) = 0; 0054 end 0055 0056 %%% prepare output 0057 varargout{1} = res; 0058 end 0059 0060 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0061 % Local Functions % 0062 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0063 0064 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0065 % 0066 % FUNCTION: getInfo 0067 % 0068 % DESCRIPTION: Get Info Object 0069 % 0070 % HISTORY: 11-07-07 M Hewitson 0071 % Creation. 0072 % 0073 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0074 0075 function ii = getInfo(varargin) 0076 if nargin == 1 && strcmpi(varargin{1}, 'None') 0077 sets = {}; 0078 pl = []; 0079 else 0080 sets = {'Default'}; 0081 pl = getDefaultPlist; 0082 end 0083 % Build info object 0084 ii = minfo(mfilename, 'ltpda_obj', '', utils.const.categories.helper, '$Id: isprop.m,v 1.2 2008/09/04 15:29:30 ingo Exp $', sets, pl); 0085 end 0086 0087 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0088 % 0089 % FUNCTION: getDefaultPlist 0090 % 0091 % DESCRIPTION: Get Default Plist 0092 % 0093 % HISTORY: 11-07-07 M Hewitson 0094 % Creation. 0095 % 0096 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0097 0098 function plo = getDefaultPlist() 0099 plo = plist(); 0100 end 0101