how can dertermination which line of string on text file
조회 수: 4 (최근 30일)
이전 댓글 표시
Hi I have some text file like that (named data.txt)
2006 1 6 1150 4.6 L
2006-01-06-1149-59
2006 1 6 1149
....
STAT SP IPHASW D HRMM SECON
2006 1 6 1149 *bold*
with line "STAT SP IPHASW D HRMM SECON" will appear on other line on other file (for eg: this file on line 20, other file on line 25). Q: how can i catch what number of line have "string" STAT SP IPHASW D HRMM SECON Thanks in advance and sorry for my bad english
댓글 수: 0
채택된 답변
KSSV
2017년 5월 5일
fid = fopen('txt file') ;
S = textscan(fid,'%s','delimiter','\n') ;
fclose(fid) ;
S = S{1} ;
idx = strfind(S, 'STAT SP IPHASW D HRMM SECON');
idx = find(not(cellfun('isempty', idx)))
댓글 수: 3
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Characters and Strings에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!