I have text.txt which contains words and numbers.
1. I want to use "for" and "if" for cells or matrices which contain string.
d = reshape(textread('text.txt','%s','delimiter','\t'),2,2)'
if h(1,1)=='apple'
k=1
end
This didn't work.
2. I want to do something like this.
for m=1:size(text)
for n=1:size(text2)
if text2(n,3) contains 'apple' (such as "My apple his, her")
if last word of text2(n,3) is text(m,2)
output(m,1)==text(m,2)
output(m,2)==text(m,1)
end
end
end
end
It is written in non-Matlab way but you know what I want to do.
This type of work might be easy if the text and text2 are matrices of numbers. But they are strings.
How can I perform the same thing I do for numerical matrices?