Documentation 
Aggregate credit ratings information into fewer rating categories
totalsGrouped = transprobgrouptotals(totals,groupingEdges)
totalsGrouped = transprobgrouptotals(totals,groupingEdges) aggregates the credit ratings information stored in the totals input into fewer ratings categories, which are defined by the groupingEdges argument.
totals 
Structure, or a struct array of length nTotals, with fields:
 
groupingEdges 
Numeric array with increasing, positive integers to indicate how to group credit ratings into categories. This table illustrates how to group a list of whole ratings into investment grade (IG) and speculative grade (SG) categories. Eight ratings are in the original list. Ratings 1 to 4 are IG, ratings 5 to 7 are SG, and rating 8 is a category of its own. In this example, the array of grouping edges is [4 7 8]. Original ratings: 'AAA' 'AA' 'A' 'BBB'  'BB' 'B' 'CCC'  'D'   Relative ordering: (1) (2) (3) (4)  (5) (6) (7)  (8)   Grouped ratings: 'IG'  'SG'  'D'   Grouping edges: (4)  (7)  (8) In general, if groupingEdges has K elements edge1 < edge2 < ... <edgeK, ratings 1 to edge1 (inclusive) are grouped in the first category, ratings edge1+1 to edge2 in the second category, and so forth. Regarding the last element, edgeK:

Hanson, S., T. Schuermann, "Confidence Intervals for Probabilities of Default," Journal of Banking & Finance, Elsevier, vol. 30(8), pages 2281–2301, August 2006.
Löffler, G., P. N. Posch, Credit Risk Modeling Using Excel and VBA, West Sussex, England: Wiley Finance, 2007.
Schuermann, T., "Credit Migration Matrices," in E. Melnick, B. Everitt (eds.), Encyclopedia of Quantitative Risk Analysis and Assessment, Wiley, 2008.