I computed all performance metrics by the following way
[validationPredictions, validationScores] = kfoldPredict(partitionedModel);
Confmat = Confusionmat(响应,验证预报)%响应是代表类的数据集中的最后一列
TP = confmat(2, 2);
TN = confmat(1, 1);
FP = confmat(1, 2);
FN = confmat(2, 1);
Accuracy = (TP + TN) / (TP + TN + FP + FN);
Sensitivity = TP / (FN + TP);
specificity = TN / (TN + FP);
z = FP / (FP+TN);
X = [0;Sensitivity;1];
Y = [0;z;1];
AUC = trapz(Y,X);% This way is used for only binary classification