Filter löschen
Filter löschen

Question about reading a file with mixed data in lines

3 Ansichten (letzte 30 Tage)
Brian
Brian am 17 Okt. 2013
Kommentiert: Brian am 18 Okt. 2013
Thanks for reading this,
I think this is a simple question to answer, but for some reason I can't get this to work. What I am trying to do is read the line:
(10 (0 1 c91 0 3))
where the '0 1 c91 0 3))' can be arbitrary: '(10 (' is always assumed to be in the file. The former is dependent on the number of data points I want to collect.
What I want to do is parse the '0 1 c91' information inside: I don't care about the '0 3)) after, and I don't care about the '(10 (' before. The c91 in particular is crucial for what I use later with fscanf, where I read a certain number of rows, the number of rows being the decimal vale of hexadecimal c91.
Is this possible? Thanks for any advice!

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 17 Okt. 2013
fscanf(fid, '(10 (%d%d%x%d%d))')
  2 Kommentare
Brian
Brian am 17 Okt. 2013
Thanks, I will try this out.
Brian
Brian am 18 Okt. 2013
Thanks! This worked perfectly.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by