My name is Kevin
Hello my name is Susan
So u1 has a matrix with 1 as the word hello is in fact in the first sentence. Then u2 has[0,1,1,1,1] as 'hello' is not in the second sentence but 'my' 'name' 'is' and 'kevin' are.
And the same goes for u3, it contains the boolean value for 'hello' 'my' 'name' 'is' 'Kevin' 'Susan' respectively, with 'Kevin' being 0 as it's not in this final sentence.
As there are 7 different words in my example, the last matrix should have 7 indices.
How would I go in implementing such an algorithm on Matlab?
The sentences are in a file which I have to read onto Matlab. I'm able to read the sentences and put them in matrices,
while~feof(file) eachLine=fgetl(file) if isempty(eachLine)||strncmp(eachLine, '%',1)||~ischar(eachLine) ...
matrix=regexp(eachLine, ' ', 'split')