Documentation 
err = cvshrink(obj)
[err,gamma]
= cvshrink(obj)
[err,gamma,delta]
= cvshrink(obj)
[err,gamma,delta,numpred]
= cvshrink(obj)
[err,...] = cvshrink(obj,Name,Value)
err = cvshrink(obj) returns a vector of crossvalidated classification error values for differing values of the regularization parameter Gamma.
[err,gamma] = cvshrink(obj) also returns the vector of Gamma values.
[err,gamma,delta] = cvshrink(obj) also returns the vector of Delta values.
[err,gamma,delta,numpred] = cvshrink(obj) returns the vector of number of nonzero predictors for each setting of the parameters Gamma and Delta.
[err,...] = cvshrink(obj,Name,Value) cross validates with additional options specified by one or more Name,Value pair arguments.
Examine the err and numpred outputs to see the tradeoff between crossvalidated error and number of predictors. When you find a satisfactory point, set the corresponding gamma and delta properties in the model using dot notation. For example, if (i,j) is the location of the satisfactory point, set
obj.Gamma = gamma(i); obj.Delta = delta(i,j);
obj 
Discriminant analysis classifier, produced using fitcdiscr. 
Specify optional commaseparated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside single quotes (' '). You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.
err 
Numeric vector or matrix of errors. err is the misclassification error rate, meaning the average fraction of misclassified data over all folds.

gamma 
Vector of Gamma values used for regularization. See Gamma and Delta. 
delta 
Vector or matrix of Delta values used for regularization. See Gamma and Delta.

numpred 
Numeric vector or matrix containing the number of predictors in the model at various regularizations. numpred has the same size as err.

Regularization is the process of finding a small set of predictors that yield an effective predictive model. For linear discriminant analysis, there are two parameters, γ and δ, that control regularization as follows. cvshrink helps you select appropriate values of the parameters.
Let Σ represent the covariance matrix of the data X, and let $$\widehat{X}$$ be the centered data (the data X minus the mean by class). Define
$$D=\text{diag}\left({\widehat{X}}^{T}*\widehat{X}\right).$$
The regularized covariance matrix $$\tilde{\Sigma}$$ is
$$\tilde{\Sigma}=\left(1\gamma \right)\Sigma +\gamma D.$$
Whenever γ ≥ MinGamma, $$\tilde{\Sigma}$$ is nonsingular.
Let μ_{k} be the mean vector for those elements of X in class k, and let μ_{0} be the global mean vector (the mean of the rows of X). Let C be the correlation matrix of the data X, and let $$\tilde{C}$$ be the regularized correlation matrix:
$$\tilde{C}=\left(1\gamma \right)C+\gamma I,$$
where I is the identity matrix.
The linear term in the regularized discriminant analysis classifier for a data point x is
$${\left(x{\mu}_{0}\right)}^{T}{\tilde{\Sigma}}^{1}\left({\mu}_{k}{\mu}_{0}\right)=\left[{\left(x{\mu}_{0}\right)}^{T}{D}^{1/2}\right]\left[{\tilde{C}}^{1}{D}^{1/2}\left({\mu}_{k}{\mu}_{0}\right)\right].$$
The parameter δ enters into this equation as a threshold on the final term in square brackets. Each component of the vector $$\left[{\tilde{C}}^{1}{D}^{1/2}\left({\mu}_{k}{\mu}_{0}\right)\right]$$ is set to zero if it is smaller in magnitude than the threshold δ. Therefore, for class k, if component j is thresholded to zero, component j of x does not enter into the evaluation of the posterior probability.
The DeltaPredictor property is a vector related to this threshold. When δ ≥ DeltaPredictor(i), all classes k have
$$\left{\tilde{C}}^{1}{D}^{1/2}\left({\mu}_{k}{\mu}_{0}\right)\right\le \delta .$$
Therefore, when δ ≥ DeltaPredictor(i), the regularized classifier does not use predictor i.