Checking if word/words are present in a sentence in a table cell.
Show older comments
I need help about a code on how to check if words like "M3 TRIPPED" is present in the sentence of the table cells, and output a matrix indicating the row number and column where this phrase is present.
Thank you.

Accepted Answer
More Answers (2)
madhan ravi
on 31 Jul 2019
Edited: madhan ravi
on 31 Jul 2019
[Rows,Columns]=find(strcmp(T{:,:},'M3 TRIPPED')) % T your table
1 Comment
Maria Pati
on 31 Jul 2019
Akira Agata
on 31 Jul 2019
Like this?
% A sample data
T = cell2table({...
'M3 TRIPPED xyz','abc','pqr';...
'def','M3 TRIPPED 123','ghi'});
% Find row and column containing 'M3 TRIPPED'
idx = contains(T{:,:},'M3 TRIPPED');
[row,col] = find(idx);
1 Comment
Maria Pati
on 1 Aug 2019
Categories
Find more on Tables in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!