How to plot from txt file using textscan?

2 次查看(过去 30 天)
MG
MG 2020-10-11
评论: MG 2020-10-11
XFOIL Version 6.99
Calculated polar for: NACA 2408
1 1 Reynolds number fixed Mach number fixed
xtrf = 1.000 (top) 1.000 (bottom)
Mach = 0.000 Re = 9.000 e 6 Ncrit = 9.000
alpha CL CD CDp CM Top_Xtr Bot_Xtr
------ -------- --------- --------- -------- -------- --------
0.000 0.2388 0.00480 0.00041 -0.0529 0.4528 0.2191
1.000 0.3512 0.00477 0.00048 -0.0532 0.3796 0.3528
2.000 0.4613 0.00494 0.00072 -0.0533 0.2523 0.5660
4.000 0.6729 0.00562 0.00159 -0.0513 0.0456 0.9816
5.000 0.7881 0.00625 0.00207 -0.0524 0.0199 1.0000
6.000 0.8975 0.00690 0.00262 -0.0521 0.0110 1.0000
7.000 1.0060 0.00760 0.00326 -0.0518 0.0076 1.0000
8.000 1.1129 0.00842 0.00404 -0.0513 0.0053 1.0000
9.000 1.2181 0.00931 0.00492 -0.0506 0.0044 1.0000
11.000 1.4217 0.01152 0.00716 -0.0484 0.0032 1.0000
12.000 1.5182 0.01294 0.00863 -0.0467 0.0027 1.0000
13.000 1.6086 0.01477 0.01056 -0.0441 0.0022 1.0000
  4 个评论
Walter Roberson
Walter Roberson 2020-10-11
You could probably add a 'HeaderLines' option to the detectImportOptions. I think it might be 'HeaderLines', 9
MG
MG 2020-10-11
Thanks! it works
filename = 'Save_Polar.txt';
opt = detectImportOptions(filename);
data = readtable(filename, opt);
D=data(6:end,1:5);
Alpha =D{:,1};
CL =D{:,2};
CD =D{:,3};
CDp =D{:,4};
CM =D{:,5};

请先登录,再进行评论。

回答(1 个)

Paul
Paul 2020-10-11
I’ve been having a lot of success lately in these types of problems by using extractFileText to read it all into a string, and then using a few manipulations to get to the data. Works well if you have a well-defined file format.

类别

Help CenterFile Exchange 中查找有关 Annotations 的更多信息

标签

产品


版本

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by