Find a word in a text file and read values from that line
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Example :
File name: mhcb0020.03o
Rinex version: 2
File type: Observation
Satellite system: GPS
Position_reference (X/Y/Z): -2664065.576700 -4323178.973800 3848368.475300
Antenna-delta (H/E/N): 0.068700 0.000000 0.000000
I need to extract the 3 values after 'Position_reference(X/Y/Z)' from the text file.
Can you help me with this?
Thanks
0 Commenti
Risposte (1)
Arif Hoq
il 7 Mar 2022
A=readtable('example2.txt','delimiter',':');
output=table2array(A(4,2))
2 Commenti
Arif Hoq
il 7 Mar 2022
Modificato: Arif Hoq
il 7 Mar 2022
or if you want to find the string (Position_reference (X/Y/Z)) in the text file
A=readtable('example2.txt','delimiter',':','ReadVariableNames',false);
str=string(table2array(A));
[idx]=find(str=={'Position_reference (X/Y/Z)'});
output=str(idx,2) % string
% for numeric result
format longG
numeric_output=rmmissing(str2double(split(output,' ')))
Vedere anche
Categorie
Scopri di più su Text Data Preparation in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!