See the description and examples at these MATLAB doc pages:
- https://www.mathworks.com/help/stats/fitcnb.html, "Train multiclass naive Bayes model"
- https://www.mathworks.com/help/stats/classificationnaivebayes.html, "Naive Bayes classification for multiclass classification"
For further reading about this technique see the reference below. (A pdf of this book is available online at https://hastie.su.domains/ElemStatLearn/)
- Hastie, Trevor, Robert Tibshirani, and Jerome Friedman. The Elements of Statistical Learning: Data Mining, Inference, and Prediction. 2nd ed. Springer Series in Statistics. New York, NY: Springer, 2009. https://doi.org/10.1007/978-0-387-84858-7.