So I have a text file like this one:
SOLUTION AT ALPHA = 0.000 DEG
I XMID YMID CURVD CP UE DUEDS
2 0.990410 -0.002254 0.009851 0.392575 -12.992179 -121.144340
3 0.989230 -0.002529 0.011062 0.378426 -13.142627 -109.923235
4 0.987462 -0.002941 0.012878 0.361882 -13.316381 -88.611258
5 0.985108 -0.003488 0.015296 0.342852 -13.513478 -75.134740
but there is not 5 lines but something between 30 and 50 lines around 25 times this patttern. I want to use "textscan" function to read this texte file and assign thoses values in a structure in the same way they are. Is this faisable? Or possible?
thanks in advance!

2 comentarios

Bob Thompson
Bob Thompson el 28 de Mzo. de 2018
Yes it is possible, and reasonable.
Walter Roberson
Walter Roberson el 28 de Mzo. de 2018
Do I understand correctly that you would have I values up to 50, after which you have another block starting with 'SOLUTION AT ALPHA' and you want to read in that data too?

Iniciar sesión para comentar.

Respuestas (1)

Star Strider
Star Strider el 28 de Mzo. de 2018

0 votos

Yes.
The format string would be:
'%f%f%f%f%f%f%f'
and you need to specify 'HeaderLines',3 (or however many headerlines there are).
The readtable (link) function is also an option.

Categorías

Más información sobre Data Import and Export en Centro de ayuda y File Exchange.

Productos

Etiquetas

Preguntada:

el 28 de Mzo. de 2018

Comentada:

el 28 de Mzo. de 2018

Community Treasure Hunt

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

Start Hunting!

Translated by