Azzera filtri
Azzera filtri

Importing METAR data from sequence of .txt-files

3 visualizzazioni (ultimi 30 giorni)
Linus Dock
Linus Dock il 5 Ott 2016
Risposto: KSSV il 5 Ott 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!

Risposte (1)

KSSV
KSSV il 5 Ott 2016
doc textscan

Categorie

Scopri di più su MATLAB Report Generator in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by