www.gusucode.com > mbcdata 工具箱 matlab 源码程序 > mbcdata/@cgoptimoptions/setEnabled.m

    function obj = setEnabled(obj, bEnable)
%SETENABLED Set the enabled status for this optimization function.
%   OPTIONS = SETENABLED(OPTIONS, STATUS) sets the optimization function
%   enabled status.  STATUS must be true or false.  When an optimization is
%   disabled, the user will still be able to register it with CAGE but will
%   not be allowed to create new optimizations using it.
%
%   See also CGOPTIMOPTIONS/GETENABLED.

%  Copyright 2000-2004 The MathWorks, Inc. and Ford Global Technologies, Inc.


if nargin < 2
    error(message('mbc:cgoptimoptions:InvalidArgument23'));
end

% Check input types
[ok, msg] = i_CheckInputs({bEnable});
if ~ok
    error('mbc:cgoptimoptions:InvalidArgument24', msg);
end

obj.enabled = bEnable;



%----------------------------------------------------------------------------------
function [ok, msg] = i_CheckInputs(in)
%----------------------------------------------------------------------------------

ok = 0; msg = '';

if ~islogical(in{1}) || (numel(in{1}) ~= 1)
   msg = 'The enable setting must be true or false.';
else
   ok = 1;
end