Error whilst using textscan function to read data

조회 수: 1 (최근 30일)
Hamza
Hamza 2014년 1월 9일
편집: Hamza 2014년 1월 9일
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개)

카테고리

Help CenterFile 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