how to extract date from a txt file while skipping other data?

2 visualizaciones (últimos 30 días)
Imtiaz nabi
Imtiaz nabi el 13 de En. de 2022
Editada: per isakson el 14 de En. de 2022
Hi there, I am reading GPS/GNSS ephemeris file and have extracted the data from the .nav file but I am confused about extracting the data from the file. Can anyone please help me? I want to extract the date from the .nav file and convert it into GPS time.
to better understand my uestion please read the attached image. The highlighted columns in row 8, row, 16 and so on represents time in Year, Month, day, hour, minute and second format. for example in row 18 after the satellite 22 this is basically 2019/7/31 2:00:00.
  2 comentarios
Cris LaPierre
Cris LaPierre el 13 de En. de 2022
It's hard to help from a screenshot. Please attach a sample file for us to use using the paperclip icon.
per isakson
per isakson el 14 de En. de 2022
Editada: per isakson el 14 de En. de 2022
Extracting the date substrings can be done with chr = fileread(...) and regexp(...) (, I guess.)
%%
chr = { '22 19 7 31 2 0 0.0 -7.379'
'0.0 1.1 2.2 3.3 4.4 5.5 6.6 9'
'30 19 8 1 2 0 0.0 -7.379' };
chr = strjoin( chr, '\n' );
xpr = '(?<=\d{2})\x20+\d{1,2}\x20+\d{1,2}\x20+\d{1,2}\x20+\d{1,2}\x20+\d{1,2}[0-9\.]+';
cac = regexp( chr, xpr, 'match' )
cac = 1×2 cell array
{' 7 31 2 0 0.0'} {' 8 1 2 0 0.0'}
Don't you need the satellite number too?

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre MATLAB en Help Center y File Exchange.

Productos


Versión

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by