MATLAB: Find a string in a character array

charismemberstrcmp

A is an m x n character array (I think that is the right term. It says m x n char in the workspace under value).
I want to find a certain row depending on the characters. So say I have a string s of size 1 x n. I want something like this:
find(strcmp(s,A(1:m,:)))
I messed around with ismember instead of strcmp a little too. Can't get it right. I only want it to return an indicator if the row matches the string s.
help is appreciated. Thanks.

Best Answer

A = ['asdf';'lelr';'wkre';'pope']
idx = all(ismember(A,'lelr'),2)
Now if you need linear indices rather than a logical index, use:
lidx = find(idx)