www.gusucode.com > mbcdata 工具箱 matlab 源码程序 > mbcdata/@cgoptimoptions/setOperatingPointsMode.m
function obj = setOperatingPointsMode(obj, sMode) %SETOPERATINGPOINTSMODE Set how the optimization operating point sets are used. % OPTIONS = SETOPERATINGPOINTSMODE(OPTIONS, MODESTR) sets the mode that % governs how the user will be allowed to set up operating point sets for % the optimization in the CAGE GUI. When MODESTR = 'any', the user will % be allowed to add any number of operating point sets. When MODESTR = % 'default', the user will be allowed to optionally define a single % operating point set to run the optimization over. When MODESTR = % 'fixed', the number of operating point sets required can be fixed by % the optimization function and the user will not be allowed to add or % remove any using the CAGE GUI. % % See also CGOPTIMOPTIONS/GETOPERATINGPOINTSMODE, % CGOPTIMOPTIONS/ADDOPERATINGPOINTSET. % Copyright 2000-2011 The MathWorks, Inc. and Ford Global Technologies, Inc. if nargin < 2 error(message('mbc:cgoptimoptions:InvalidArgument31')); end % Check input types [ok, msg] = i_CheckInputs({sMode}); if ~ok error('mbc:cgoptimoptions:InvalidArgument32', msg); end if strcmp(sMode, 'default') % Only allow zero/one dataset if length(obj.operatingpoints.details)>1 warning(message('mbc:cgoptimoptions:InvalidState9')); obj.operatingpoints.details = obj.operatingpoints.details(1); end end obj.operatingpoints.mode = sMode; %---------------------------------------------------------------------- function [ok, msg] = i_CheckInputs(in) %---------------------------------------------------------------------- ok = false; msg = ''; if ~ischar(in{1}) || isempty(in{1}) || ~any(strcmp(in{1}, {'any', 'fixed', 'default'})) msg = 'The mode must be either ''any'', ''fixed'' or ''default''.'; else ok = true; end