MATLAB Answers

How to get row index which have my text

9 views (last 30 days)
Mekala balaji
Mekala balaji on 14 Jan 2020
Commented: Mekala balaji on 14 Jan 2020
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.

  0 Comments

Sign in to comment.

Answers (1)

David Hill
David Hill on 14 Jan 2020
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');

  1 Comment

Mekala balaji
Mekala balaji on 14 Jan 2020
first of all, I am unable to read whole content of the file.

Sign in to comment.

Sign in to answer this question.

Tags

Products


Release

R2017a