how to read .dat file using txtscan ?

4 vues (au cours des 30 derniers jours)
Vishnu Dhakad
Vishnu Dhakad le 23 Oct 2018
Commenté : jonas le 29 Oct 2018
Please find the attachment.
  3 commentaires
KSSV
KSSV le 23 Oct 2018
jonas why the possible answer is in comment?
jonas
jonas le 23 Oct 2018
Modifié(e) : jonas le 23 Oct 2018
Apart from the low effort put into my comment, I did not feel that it addressed the actual question, which seems to be specifically about textscan. I made the post shortly after the question was posted, so I was hoping for a quick reply after which I could expand my comment into an actual answer. Perhaps I should have phrased my comment in a different way.

Connectez-vous pour commenter.

Réponse acceptée

jonas
jonas le 23 Oct 2018
Modifié(e) : jonas le 23 Oct 2018
You can use readtable since the data is tabular.
T = readtable('AE33_AE33-S02-00184_20170102.dat','headerlines',8)
...gave me a 71 column table. Some of your headers are not valid variable names so I did not import them at all.
If you insist on using textscan, then
fid = fopen('AE33_AE33-S02-00184_20170102.dat')
out = textscan(fid,['%{yyyy/MM/dd}D %{hh:mm:ss}T',repmat('%f',1,69)],'headerlines',9)
fclose(fid)
  1 commentaire
jonas
jonas le 29 Oct 2018
in reply to Vishu's "Answer"
Odd. I suspect you are using an ancient release that cannot parse the duration format? You can always import the dates as strings. Try this:
fid = fopen('AE33_AE33-S02-00184_20170102.dat')
out = textscan(fid,['%s%s',repmat('%f',1,69)],'headerlines',9)
fclose(fid)

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Standard File Formats dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by