%% Sort Classes in a Fixed Order
% Load a sample of predicted and true labels for a classification problem. trueLabels are the true labels for an image classification problem and predictedLabels are the predictions of a convolutional neural network. Create a confusion matrix chart.

load('Cifar10Labels.mat','trueLabels','predictedLabels');
figure
cm = confusionchart(trueLabels,predictedLabels);

%
% Reorder the classes of the confusion matrix chart so that the classes are in a fixed order.

sortClasses(cm, ...
    ["cat" "dog" "horse" "deer" "bird" "frog", ...
    "airplane" "ship" "automobile" "truck"])

%
% Copyright 2018 The MathWorks, Inc.