www.gusucode.com > mbcdata 工具箱 matlab 源码程序 > mbcdata/@cgoptimobjective/getTypeChooserOptions.m
function [name, opts] = getTypeChooserOptions(obj, pProj, Optim) %GETTYPECHOOSEROPTIONS Get alternative objects to display as options % % [NAME, OPTS] = GETTYPECHOOSEROPTIONS(OBJ, PPROJ, OPTIM) returns a group % name and a group of options that should be displayed for OBJ when the % method GUITYPECHOOSER is called. OPTS must be a (1-by-N) struct array % with fields Type, Function and Destructor. Function is a function % handle that creates an instance of a cgoptimitem when called. Type % contains a string that describes the new object type. The type string % should match the return of getType on the new object. % Copyright 2005-2006 The MathWorks, Inc. and Ford Global Technologies, Inc. name = 'Objective'; ObjectName = getName(obj); TypeChange = canChangeType(obj); DefType = getObjectiveType(obj); opts = struct('Type', {'Point Objective', 'Sum Objective'}, ... 'Function', {@(dlg) i_createitem(@cgpointobjective, ObjectName, DefType, TypeChange), ... @(dlg) i_createitem(@cgsumobjective, ObjectName, DefType, TypeChange)}); function obj = i_createitem(func, name, deftype, canchange) obj = func(name, deftype); obj = setAllowTypeChange(obj, canchange);