Error whilst using textscan function to read data
1 次查看(过去 30 天)
显示 更早的评论
Hi Everyone,
I am trying to extract data using the textscan function.
After I open the data_file.txt file, Matlab is happy to read in the Mach and Incidence values (lines 6 to 8 in matlab script and line 992 in data file) as well as the Lift and Moment Coeff. (Lines 10-12). The problem starts at line 14, for some reason Matlab does not continue to read the data file ( Error: Index exceeds matrix dimensions. Error in test (line 15) data.CDP = number{1}(1)).
However, if I first close and then open the file again and set HeaderLines to the correct value to read CDP, it works. It also works if I ignore lines 10-12 and go straight to line 14.
I was wondering if there is a way to avoid having to keep opening and closing the data file but this seems to be the only way to get the script to run.
Thank you in advance,
Hamza
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 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!