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 个评论
Bob Thompson
2018-3-28
Yes it is possible, and reasonable.
Walter Roberson
2018-3-28
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 个)
Star Strider
2018-3-28
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).
类别
在 帮助中心 和 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!