www.gusucode.com > mbctools 工具箱 matlab 源码程序 > mbctools/@xregbdrydev/getFitOptions.m
function [opts,ok] = getFitOptions(bdev,action) %GETFITOPTIONS fit options optimmgr boundary model % % [opts,ok] = getFitOptions(bdev,action); % Copyright 2008 The MathWorks, Inc. and Ford Global Technologies, Inc. if nargin<2 action = 'all'; end action = lower( action ); doAll = isequal( action, 'all' ); spo = bdev.SpecialPointOptions; bpo = bdev.BoundaryPointOptions; cfo = bdev.ConstraintFitOptions; con = bdev.Constraint; if isempty( spo ), spo = getspecialpointoptions( con ); end if isempty( bpo ), bpo = getBoundaryPointOptions( con ); end if isempty( cfo ), cfo = getConstraintFitOptions( con ); end if isempty( spo ) && isempty( bpo ) && isempty( cfo ), % There are no fit options opts = []; elseif doAll, % Use an "optimisation manager" to handle all the options opts = contextimplementation( xregoptmgr, con, '', '', 'Constraint Fitting', @getAllFitOptions ); opts = AddOption( opts, 'SpecialPointOptions', spo, class( spo ), 'Special Points', ~isempty( spo ) ); opts = AddOption( opts, 'BoundaryPointOptions', bpo, class( bpo ), 'Boundary Points', ~isempty( bpo ) ); opts = AddOption( opts, 'ConstraintFitOptions', cfo, class( cfo ), 'Constraint Fit', ~isempty( cfo ) ); end ok = ~isempty(opts) && ~isnull(opts); end