xxsimGetSubmodelProperties - Get submodel properties of a submodel (name, description, version, etc.). Syntax: retval = xxsimGetSubmodelProperties('submodel_name', keys) Inputs: submodelPath = (optional) path to the submodel to obtain the properties of, using dots to separate hierarchy in the model. Note: if no name is specified, the top-level main model is selected. keys = (optional) only obtain the properties for which a key is specified. Outputs: retval = returns a structure array of the requested properties. Examples: retval = xxsimGetSubmodelProperties('Controller.PID') - returns the structure array with all submodel properties for the submodel "PID" within the submodel "Controller". retval = xxsimGetSubmodelProperties('PID', 'Keywords', 'Title') - returns the structure array with the Keywords and Title properties of the submodel named "PID". See also: xxsimSetSubmodelProperties Author: Controllab Products B.V. email: info@controllab.nl Website: http://www.controllab.nl December 2017
0001 function retval = xxsimGetSubmodelProperties(submodelName, varargin) 0002 % xxsimGetSubmodelProperties - Get submodel properties of a submodel (name, description, version, etc.). 0003 % 0004 % Syntax: 0005 % retval = xxsimGetSubmodelProperties('submodel_name', keys) 0006 % 0007 % Inputs: 0008 % submodelPath = (optional) path to the submodel to obtain the properties of, using dots to separate hierarchy in the model. 0009 % Note: if no name is specified, the top-level main model is selected. 0010 % keys = (optional) only obtain the properties for which a key is specified. 0011 % 0012 % Outputs: 0013 % retval = returns a structure array of the requested properties. 0014 % 0015 % Examples: 0016 % retval = xxsimGetSubmodelProperties('Controller.PID') 0017 % 0018 % - returns the structure array with all submodel properties for the submodel "PID" within the submodel "Controller". 0019 % 0020 % retval = xxsimGetSubmodelProperties('PID', 'Keywords', 'Title') 0021 % 0022 % - returns the structure array with the Keywords and Title properties of the submodel named "PID". 0023 % 0024 % See also: xxsimSetSubmodelProperties 0025 % 0026 % Author: Controllab Products B.V. 0027 % email: info@controllab.nl 0028 % Website: http://www.controllab.nl 0029 % December 2017 0030 0031 %------------- BEGIN CODE -------------- 0032 0033 % Check if the submodelName is a string. 0034 if(~ischar(submodelName)) 0035 error('Please specify a valid submodel name.'); 0036 end; 0037 0038 keysArray = {}; 0039 0040 for i =1:length(varargin) 0041 if(~ischar(varargin{i})) 0042 error('At least one of your properties is not of type string.'); 0043 end; 0044 keysArray(end+1) = {varargin{i}}; 0045 end; 0046 0047 retval = xrlinvoke('xxsim.model.getSubmodelProperties', struct('submodelName',submodelName,'keys',{{keysArray,'array'}})); 0048 end