Question about reading a file with mixed data in lines

1 vue (au cours des 30 derniers jours)
Brian
Brian le 17 Oct 2013
Commenté : Brian le 18 Oct 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!

Réponse acceptée

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

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by