I am trying to use the function regexp in Matlab. The first code is ok as follows:
data={'ABCD' 'BCDE' 'ACBE' 'ADEBC '} % 3 AB, 2 BE, 2 BC
%res = regexp( data, 'A.*.*B') % OK code
The above code is to count the A.*.B order in the data cell array. However, when I try to test with the celldata which is defined as follows:
celldata = {'AB'; 'BE'; 'BC'}
for kk=1:length(celldata)
res = regexp( data,'celldata{kk}(1).*.*celldata{kk}(2)')
end
The 'res' value return NULL . Please kindly where is the bug here .Could anyone please help me to count the order of each element in celldata in data ? Thanks !
Use the concatenation of strings
to find the amount of occurences