From: Erik on
Sounds simple (and might be simple too):
Suppose you have a cell array of strings, like
cellArray = {'I' 'want' 'this' 'string'}
and now want the index of the string 'this'. Just like the find function returns the index of a specified numeric value. I know there is strfind:

strfind(cellArray,'this')

ans =

[] [] [1] []

But how to get this (really fast, need to do this very often with big cellArrays) to an index? Sounds so easy, but somehow I just can't get it working!
Very thankful for any help!
Thanx!
Erik
From: David Young on
You could try using ismember:

[m, i] = ismember('this', cellArray)

returns the index in the second argument. I don't know how the speed compares to other methods though.
From: Erik on
"David Young" <d.s.young.notthisbit(a)sussex.ac.uk> wrote in message <hq1hpt$ns6$1(a)fred.mathworks.com>...
> You could try using ismember:
>
> [m, i] = ismember('this', cellArray)
>
> returns the index in the second argument. I don't know how the speed compares to other methods though.

Perfect! That's just what I wanted. Thank you so very much!
From: Jan Simon on
Dear Erik!

cellArray = {'I' 'want' 'this' 'string'}
strcmp(cellArray, 'this')
==> logical([0, 0, 1, 0])

Jan