i want to compare [1*232] cells of strings containing individual words from text document with [1*23] cells that contain individual sentences from the same text, can any one help me how to program it in Matlab? for example: "pollution" and "trees" are two words in separate cells and following are the two sentences in separate cells: 1. trees reduce pollution. 2. trees prevent floods.
what i want to do is put 0 or 1 after comparing pollution and trees with both the sentences or in my case "n" sentences and put 1's and 0's in the form of matrices. any help will be appreciated.
strfind, example:document={'trees reduce pollution','trees prevent floods'};index=strfind(document,'pollution');found=cellfun(@(x)(~isempty(x)),index)