There is a char matrix. Each row is a word. All the words/rows have the same length.
Is there anyway to find a target word in this matrix using find()
function?
Say M=[o k a y; g o o d; h a v e];
A target word W='have';
Is there any function to search W
in M
and return the row index?
When I try index = find(isequal(W,M))
and index = find(isequal(W,M(:,:)))
, they both return empty array.
I know that I can use linear search, i.e. to compare row by row, just wonder if there is a built-in function to solve this problem. Thanks!