| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Statistics Toolbox |
| Contents | Index |
| Learn more about Statistics Toolbox |
Reorder levels
B = reorderlevels(A,newlevels)
B = reorderlevels(A,newlevels) reorders the levels of the categorical array A. newlevels is a cell array of strings or a 2-D character matrix that specifies the new order. newlevels must be a reordering of getlabels(A).
The order of the levels of an ordinal array has significance for relational operators, minimum and maximum, and for sorting.
Reorder hockey standings:
standings = ordinal(1:3,{'Leafs','Canadiens','Bruins'});
getlabels(standings)
ans =
'Leafs' 'Canadiens' 'Bruins'
standings = reorderlevels(standings,...
{'Canadiens','Leafs','Bruins'});
getlabels(standings)
ans =
'Canadiens' 'Leafs' 'Bruins'addlevels,droplevels, getlabels, islevel,mergelevels
![]() | RegV property (gmdistribution) | repartition (cvpartition) | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |