Error whilst using textscan function to read data

1 view (last 30 days)
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

Answers (0)

Categories

Find more on Large Files and Big Data in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!