Borrar filtros
Borrar filtros

Question about reading a file with mixed data in lines

3 visualizaciones (últimos 30 días)
Brian
Brian el 17 de Oct. de 2013
Comentada: Brian el 18 de Oct. de 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!

Respuesta aceptada

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

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Logical en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by