MATLAB: Comparing characters in a matrix

charactercomparing charactersloopmatrix

I have a (nx1) matrix,M, that stores a list of characters and I need to iterate through a loop and keep comparing the i-th character in the matrix with a temp character.
But I'm not sure how to do this, i tried using M{i,1}== tmp and strcmp(M{i,1},tmp) but neither seem to work. Please help, thank you so much!

Best Answer

strcmp(M(i),tmp)