MATLAB: Checking if word/words are present in a sentence in a table cell.
celltable
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.
Best Answer
Try contains().
if contains(ca{2, 1}, 'M3 TRIPPED')
% It contains that phrase in row 2, column 1 of cell array called ca
Matrices have te same number of elements in all columns and rows, repsectively. This is the definition of a matrix. So you cannot store vectors of different lengths in a matrix.
You can pad the vectors with NaNs, if this is sufficient for your problem. But storing a collection of vectors of different size in a cell array seems to be clear, clean and efficient.
Best Answer