MATLAB: String compare

strings

Hi,
likely a beginners question. I have a matrix containing strings, say
A=['aa';'bb']
now I'm looking for a function f(x,string) that will do row-wise string comparison such that
f(A,'aa') leads to [1;0]
is that possible? I failed to use strcmp.
Thanks Jörg

Best Answer

If you can use
A = {'aa'; 'bb'}
then
strcmp(A, 'aa')
works. The cell array for A might be better because it lets you have unequal length strings.