xxsimSaveProcessedModel

PURPOSE ^

xxsimSaveProcessedModel - saves the changes made to active proceesed model.

SYNOPSIS ^

function [result] = xxsimSaveProcessedModel(varargin)

DESCRIPTION ^

 xxsimSaveProcessedModel - saves the changes made to active proceesed model.

 Syntax:
   result = xxsimSaveProcessedModel(fileName, boolean)

 Inputs:
   fileName = (Optional) directory path to which the model should be saved .
              Note: entering an empty string saves the processed model under its current name
                    if it has any (default).
   boolean =  (Optional) indicates if the processed model should be saved only run specs .
              true - only run specifications are saved .
              false - run specifications, plots and other settings are saved (Default) .

 Outputs:
   result = boolean indicating the success.

 Examples:
   result = xxsimSaveProcessedModelModel('C:\temp\test.emp')

      - saves the current model to the file 'test.emp'

 See also: xxsimOpenModel, xxsimCloseModel, xxsimSaveSubmodel

 Author: Controllab Products B.V.
 email: info@controllab.nl
 Website: http://www.controllab.nl
 September 2023

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [result] = xxsimSaveProcessedModel(varargin)
0002 % xxsimSaveProcessedModel - saves the changes made to active proceesed model.
0003 %
0004 % Syntax:
0005 %   result = xxsimSaveProcessedModel(fileName, boolean)
0006 %
0007 % Inputs:
0008 %   fileName = (Optional) directory path to which the model should be saved .
0009 %              Note: entering an empty string saves the processed model under its current name
0010 %                    if it has any (default).
0011 %   boolean =  (Optional) indicates if the processed model should be saved only run specs .
0012 %              true - only run specifications are saved .
0013 %              false - run specifications, plots and other settings are saved (Default) .
0014 %
0015 % Outputs:
0016 %   result = boolean indicating the success.
0017 %
0018 % Examples:
0019 %   result = xxsimSaveProcessedModelModel('C:\temp\test.emp')
0020 %
0021 %      - saves the current model to the file 'test.emp'
0022 %
0023 % See also: xxsimOpenModel, xxsimCloseModel, xxsimSaveSubmodel
0024 %
0025 % Author: Controllab Products B.V.
0026 % email: info@controllab.nl
0027 % Website: http://www.controllab.nl
0028 % September 2023
0029 
0030 %------------- BEGIN CODE --------------
0031     %check input arguments
0032     modelFilename = '';
0033   onlyRunSpecs = false;
0034 
0035     if length(varargin)==1 || length(varargin)==2
0036 
0037         if ~ischar(varargin{1})
0038             error('Input argument 1 should be a file name.');
0039         else
0040             modelFilename = varargin{1};
0041         end
0042     if length(varargin)==2
0043       if ~isbool(varargin{2})
0044         error('Input argument 2 should be a boolean.');
0045       else
0046       onlyRunSpecs = varargin{2};
0047     endif
0048     elseif length(varargin) > 2
0049         error('This function expects only 2 (optional) input argument.');
0050     end
0051 
0052     % set the result varaible
0053     result = true;
0054 
0055     reply = xrlinvoke('xxsim.saveProcessedModel', struct('name', modelFilename, 'onlyRunSpecs', onlyRunSpecs));
0056     if (isempty(reply) )
0057         error('could not save the proceesed model');
0058     end
0059 
0060     % return the succes
0061     result = true;
0062 end
0063 %------------- END OF CODE --------------

Generated on Thu 25-Apr-2024 10:30:24