Text scan huge text file

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 个评论

Yes it is possible, and reasonable.
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?

请先登录,再进行评论。

回答(1 个)

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.

类别

在 帮助中心 和 File Exchange 中查找有关 Data Import and Export 的更多信息

产品

标签

Community Treasure Hunt

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

Start Hunting!

Translated by