Borrar filtros
Borrar filtros

Importing METAR data from sequence of .txt-files

2 visualizaciones (últimos 30 días)
Linus Dock
Linus Dock el 5 de Oct. de 2016
Respondida: KSSV el 5 de Oct. de 2016
Hi! I have some problems importing data from files that look like this:
METAR ESDF 010020Z AUTO 31003KT 230V350 9999NDV NCD 12/08 Q1017 METAR ESDF 010050Z AUTO 24003KT 230V320 9999NDV NCD 12/08 Q1017 METAR ESDF 010120Z AUTO 25003KT 230V350 9999NDV NCD 11/08 Q1017 METAR ESDF 010150Z AUTO 25005KT 230V350 9999NDV NCD 11/08 Q1017 METAR ESDF 010220Z AUTO 24005KT 230V310 9999NDV NCD 11/08 Q1017 METAR ESDF 010250Z AUTO 30003KT 230V350 9999NDV NCD 11/08 Q1017 METAR ESDF 010320Z AUTO VRB02KT 9999NDV NCD 11/08 Q1017 METAR ESDF 010350Z VRB02KT CAVOK 11/08 Q1017 METAR ESDF 010420Z 00000KT CAVOK 12/09 Q1018 METAR ESDF 010450Z 29003KT CAVOK 12/11 Q1018 METAR ESDF 010520Z 30005KT 230V350 CAVOK 13/11 Q1018
The import stops around line 6300 out of 450000. The reason is a linechange in the .txt file that is erroneous. Is there a way of blocking this line and continue with the next instead?
The next step for me is to import a sequence of these files with:
txtFiles = dir('*.txt') numfiles = length(txtFiles); mydata = cell(1, numfiles);
for k = 1:numfiles try mydata{k} = importdata(txtFiles(k).name); catch disp('error') end end
Are there any better way of importing these files?
Thank you!

Respuestas (1)

KSSV
KSSV el 5 de Oct. de 2016
doc textscan

Categorías

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

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by