using findstr function for scanning strings in text file.
Show older comments
2.11 OBSERVATION DATA M (MIXED) RINEX VERSION / TYPE
teqc 2014Jan16 NOAA/NOS/NGS/CORS 20150102 00:26:47UTCPGM / RUN BY / DATE
Solaris x86 5.10|AMD64|cc SC5.8 -xarch=amd64|=+|=+ COMMENT
teqc 2014Jan16 NOAA/NOS/NGS/CORS 20150102 00:15:53UTCCOMMENT
BIT 2 OF LLI FLAGS DATA COLLECTED UNDER A/S CONDITION COMMENT
BRMU MARKER NAME
42501S004 MARKER NUMBER
Giovanni Sella NGS OBSERVER / AGENCY
351248 LEICA GRX1200GGPRO 8.71/3.823 REC # / TYPE / VERS
00480 JAVRINGANT_DM NONE ANT # / TYPE
2304703.4760 -4874817.1770 3395186.9500 APPROX POSITION XYZ
0.0000 0.0000 0.0000 ANTENNA: DELTA H/E/N
1 1 WAVELENGTH FACT L1/2
10 L1 L2 L5 C1 C2 P2 C5 S1 S2# / TYPES OF OBSERV
S5 # / TYPES OF OBSERV
30.0000 INTERVAL
%Above is the rinex.txt file. I need to classify how many # / TYPES OF OBSERV string exist. The below code works proper in text file if only 1 line includes # / TYPES OF OBSERV.
fide = fopen('rinex.txt')
head_lines = 0
while 1
head_lines = head_lines+1
line = fgetl(fide)
answer = findstr(line,'# / TYPES OF OBSERV')
if ~isempty(answer)
break;
end
end
%The second # / TYPES OF OBSERV doesn't appear in line.
Accepted Answer
More Answers (0)
Categories
Find more on Characters and Strings in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!