MATLAB: Any easier way to find cell by string

find cell by string

Hi:
I have a cell array like below:
A{1}='test1a';
A{2}='test2a';
A{3}='test3a';
A{4}='test4a';
A{5}='test1b';
A{6}='test2b';
A{7}='test3b';
A{8}='test4b';
...
I want to find the location where 'test*a' are at, in this case, it should be 1,2,3,4
Yes, I can write a for-loop to read-justify cell in this array one by one, but I want know if there is any easier way to do this? such as
strfind(A,'test*a')
of course this is not available in Matlab
Thanks!
Yu

Best Answer

Assuming the strings all start with 'test', e.g.
find(cellfun(@(C)C(end)=='a',A))