How to get row index which have my text

3 次查看(过去 30 天)
Hi Helo
How are you mekala
what are you doing
where are you going mekala
I want to get the row index if row contains "mekala
I use below code:
fid=fopen("test.txt")
data=fgetl(fid)
idx=strfind(data,'mekala').
idx is showing empty.

回答(1 个)

David Hill
David Hill 2020-1-14
I assume you loaded your text into a cell.
a={'Hi Helo';'How are you mekala';'what are you doing';'where are you going mekala'};
b=strfind(a,'mekala');

类别

Help CenterFile Exchange 中查找有关 Data Import and Export 的更多信息

标签

产品


版本

R2017a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by