MATLAB: How to search in a text cell by a word

copy cellsdata miningfind a string in a textsearch data

i have a large data (text and numbers), i want to search for a word in a specific cell (contaning text) of a coloumn in all rows. a(:,6)
and then copy all the rows containing the word in a new file.
how i can do this ?
i try
j=1 for i=1:size(data,1) if isequal (data{i,6}, ' the word') d(j)=i j=j+i end end newdata=data(D,:);

Best Answer

  • The standard comparison functions used with numeric variables don’t work with strings. Consider using strcmp or its many friends (most of them linked to on that page). One of them should work for you.