xxsimCloseModel - closes active 20-sim model without saving changes. Syntax: retval = xxsimCloseModel(boolean) Inputs: boolean = (optional)indicates if 20-sim editor should be closed with the active model. true - closes active 20-sim editor. false - closes the active model leaving the editor open(Default). Note: * Use xxsimSetActiveModel to set the model 'active' in case there is an other working model open. * One 20-sim editor should be open at all times, so xxsimCloseModel does NOT close the last remaining editor. Outputs: retval = returns true if model is closed properly. Examples: retval = xxsimCloseModel(); Closes the active 20-sim model without saving changes to the model. retval = xxsimCloseModel(true); Closes the active 20-sim model and the editor without saving change to the model. See also: xxsimOpenModel, xxsimSetActiveModel, xxsimGetActiveModel Author: Controllab Products B.V. email: info@controllab.nl Website: http://www.controllab.nl November 2015
0001 function [retval] = xxsimCloseModel(varargin) 0002 % xxsimCloseModel - closes active 20-sim model without saving changes. 0003 % 0004 % Syntax: 0005 % retval = xxsimCloseModel(boolean) 0006 % 0007 % Inputs: 0008 % boolean = (optional)indicates if 20-sim editor should be closed with the active model. 0009 % true - closes active 20-sim editor. 0010 % false - closes the active model leaving the editor open(Default). 0011 % Note: * Use xxsimSetActiveModel to set the model 'active' in case there is an 0012 % other working model open. 0013 % * One 20-sim editor should be open at all times, so xxsimCloseModel does NOT 0014 % close the last remaining editor. 0015 % 0016 % Outputs: 0017 % retval = returns true if model is closed properly. 0018 % 0019 % Examples: 0020 % retval = xxsimCloseModel(); 0021 % Closes the active 20-sim model without saving changes to the model. 0022 % retval = xxsimCloseModel(true); 0023 % Closes the active 20-sim model and the editor without saving change to the model. 0024 % 0025 % See also: xxsimOpenModel, xxsimSetActiveModel, xxsimGetActiveModel 0026 % 0027 % Author: Controllab Products B.V. 0028 % email: info@controllab.nl 0029 % Website: http://www.controllab.nl 0030 % November 2015 0031 0032 %------------- BEGIN CODE -------------- 0033 %check input arguments 0034 0035 if length(varargin)>1 0036 error('Too many input arguments.'); 0037 end 0038 if length(varargin)==0 0039 closeWindow = true; 0040 else 0041 if ~islogical(varargin{1}) 0042 error('Input argument 1 should be a boolean.'); 0043 end 0044 0045 closeWindow = varargin{1}; 0046 end 0047 0048 0049 retval = false; 0050 0051 retval = xrlinvoke('xxsim.closeModel', struct('closewindow', closeWindow)); 0052 if ( retval == false ) 0053 error('could not close the model') 0054 end 0055 0056 end 0057 %------------- END OF CODE --------------