%% Obtain Group Constraints for a PortfolioCVaR Object
% Suppose you have a portfolio of five assets and you want to ensure that the first three assets constitute at most 30% of your portfolio. Given a PortfolioCVaR object p with the group constraints set, obtain the values for GroupMatrix, LowerGroup, and UpperGroup.

G = [ true true true false false ];
p = PortfolioCVaR;
p = setGroups(p, G, [], 0.3);
[GroupMatrix, LowerGroup, UpperGroup] = getGroups(p)

% Copyright 2015 The MathWorks, Inc.