Yes, ClassificationTree always predicts class labels based on posterior probabilities. In that, ClassificationTree/predict deviates from classregtree/eval method. Unfortunately, this is not explained in the documentation in sufficient detail.
If you want to predict labels based on costs, you can do what you said
[~,~,n] = predict(tree, meas); tree.NodeClass(n)
Or you can apply the "average cost" correction before growing the tree. This correction is used by a tree grown with costs. Compare:
t1 = ClassificationTree.fit(meas,species,'Cost',costMat,'ClassNames',{'setosa' 'versicolor' 'virginica'})
and
t2 = ClassificationTree.fit(meas,species,'prior',sum(costMat,2),'ClassNames',{'setosa' 'versicolor' 'virginica'})
The trees are identical, but the 2nd tree predicts 'versicolor' for observations that landed on node 8.
