www.gusucode.com > mbcdata 工具箱 matlab 源码程序 > mbcdata/@cgoptimrunner/private/pGetItemsFor.m

    function Items = pGetItemsFor(obj, itemType, itemNames)
%PGETITEMSFOR Get cell array of items
%
%   PGETITEMSFOR(OBJ, TYPE, NAMES) returns a cell array of items.  TYPE
%   must be one of 'objectives' or 'constraints' and NAMES is an optional
%   cell array of item names to return.  If NAMES is omitted all items will
%   be returned.

%   Copyright 2006 The MathWorks, Inc.


switch lower(itemType)
    case 'objective'
        Items = obj.Objectives.Items;
        if nargin>2
            Items = Items(getObjectiveIndex(obj.Setup, itemNames));
        end

    case 'constraint'
        Items = obj.Constraints.Items;
        if nargin>2
            Items = Items(getConstraintIndex(obj.Setup, itemNames));
        end
end