How is cross validation used to prune a decision tree
I don't know how this is implemented in matlab. I know that some packages use cross validation to decide whether to grow the tree or not. Quite simply, they decide whether to grow based on that evaluation.

(Notice what a lot of packages call pruning is: during training, they mark branches with some score criterium and then remove if the user wants afterwards.)

Personally, I use sklearn which does not have this feature. So, I just do a grid search for several values of max_depth and use whatever maximizes accuracy or whatever score I want.