|
Hi all,
I have two arrays as following,
array1 = {'AA','EE'};
array2 = {'BB','AA','FF','CC','EE'};
I would like to match individual elements in array1 to array2, and return the index in array2. For instance, I would like to results be
ix = [2, 5];
I think that I need to use 'cellfun' and 'strmatch'. I tried following, but I am not sure what the error means. Could anybody give me some hints how to use 'cellfun' and 'strmatch' together? Thank you very much.
ix = cellfun(@(array1) strmatch(array1{1}, array2,'exact'), array2)
??? Cell contents reference from a non-cell array object.
Error in ==> NW_construction_CLCI>@(test1)strmatch(test1{1},test2,'exact')
Wendy
|