Documentation 
Crossvalidated classification model
ClassificationPartitionedModel is a set of classification models trained on crossvalidated folds. Estimate the quality of classification by cross validation using one or more "kfold" methods: kfoldPredict, kfoldLoss, kfoldMargin, kfoldEdge, and kfoldfun.
Every "kfold" method uses models trained on infold observations to predict the response for outoffold observations. For example, suppose you cross validate using five folds. In this case, the software randomly assigns each observation into five roughly equally sized groups. The training fold contains four of the groups (i.e., roughly 4/5 of the data) and the test fold contains the other group (i.e., roughly 1/5 of the data). In this case, cross validation proceeds as follows:
The software trains the first model (stored in CVMdl.Trained{1}) using the observations in the last four groups and reserves the observations in the first group for validation.
The software trains the second model (stored in CVMdl.Trained{2}) using the observations in the first group and last three groups, and reserves the observations in the second group for validation.
The software proceeds in a similar fashion for the third to fifth models.
If you validate by calling kfoldPredict, it computes predictions for the observations in group 1 using the first model, group 2 for the second model, and so on. In short, the software estimates a response for every observation using the model trained without that observation.
CVMdl = crossval(Mdl) creates a crossvalidated classification model from a classification model (Mdl).
Alternatively:
CVDiscrMdl = fitcdiscr(X,Y,Name,Value)
CVEnsMdl = fitensemble(X,Y,Name,Value)
CVKNNMdl = fitcknn(X,Y,Name,Value)
CVNBMdl = fitcnb(X,Y,Name,Value)
CVSVMMdl = fitcsvm(X,Y,Name,Value)
CVTreeMdl = fitctree(X,Y,Name,Value)
create a crossvalidated model when name is either 'CrossVal', 'KFold', 'Holdout', 'Leaveout', or 'CVPartition'. For syntax details, see fitcdiscr, fitensemble, fitcknn, fitcnb, fitcsvm, and fitctree.
For a crossvalidated, errorcorrecting output code multiclass model, see ClassificationPartitionedECOC and fitcecoc.
Mdl 
A classification model. Mdl can be any of the following:

CategoricalPredictors 
List of categorical predictors. If Model is a trained classification tree, then CategoricalPredictors is a numeric vector with indices from 1 through p, where p is the number of columns of X. If Model is a trained discriminant analysis or support vector machine classifier, then CategoricalPredictors is an empty vector ([]).  
ClassNames 
List of elements in Y with duplicates removed. ClassNames has the same data type as the data in the argument Y, and therefore can be a categorical or character array, logical or numeric vector, or cell array of strings.  
Cost 
Square matrix, where Cost(i,j) is the cost of classifying a point into class j if its true class is i. If CVModel is a crossvalidated ClassificationDiscriminant, ClassificationKNN, or ClassificationNaiveBayes model, then you can change its cost matrix to e.g., CostMatrix, using dot notation. CVModel.Cost = CostMatrix  
CrossValidatedModel 
Name of the crossvalidated model, which is a string.  
KFold 
Number of folds used in crossvalidated model, which is a positive integer.  
ModelParameters 
Object holding parameters of CVModel.  
Partition 
The partition of class CVPartition used in creating the crossvalidated model.  
PredictorNames 
Cell array of strings containing the predictor names, in the order that they appear in X.  
Prior 
Prior probabilities for each class. Prior is a numeric vector whose entries relate to the corresponding ClassNames property. If CVModel is a crossvalidated ClassificationDiscriminant or ClassificationNaiveBayes model, then you can change its vector of priors to e.g., priorVector, using dot notation. CVModel.Prior = priorVector  
ResponseName 
String describing the response variable Y.  
ScoreTransform 
String representing a builtin transformation function, or a function handle for transforming predicted classification scores. To change the score transformation function to, e.g., function, use dot notation.
 
Trained 
The trained learners, which is a cell array of compact classification models.  
W 
The scaled weights, which is a vector with length n, the number of rows in X.  
X 
Numeric matrix of predictor values. Each column of X represents one variable, and each row represents one observation.  
Y 
Categorical or character array, logical or numeric vector, or cell array of strings specifying the class labels for each observation. Y has the same number of rows as X, and each entry of Y is the response to the data in the corresponding row of X. 
kfoldEdge  Classification edge for observations not used for training 
kfoldfun  Cross validate function 
kfoldLoss  Classification loss for observations not used for training 
kfoldMargin  Classification margins for observations not used for training 
kfoldPredict  Predict response for observations not used for training 
Value. To learn how value classes affect copy operations, see Copying Objects in the MATLAB documentation.
To estimate posterior probabilities of trained, crossvalidated SVM classifiers, use fitSVMPosterior.
ClassificationDiscriminant  ClassificationECOC  ClassificationEnsemble  ClassificationKNN  ClassificationNaiveBayes  ClassificationPartitionedEnsemble  ClassificationSVM  ClassificationTree  CompactClassificationDiscriminant  CompactClassificationEnsemble  CompactClassificationNaiveBayes  CompactClassificationSVM  CompactClassificationTree  fitcdiscr  fitcecoc  fitcknn  fitcnb  fitcsvm  fitctree  fitensemble  fitSVMPosterior  RegressionPartitionedModel