Import data of flexible / variable size with textscan
이전 댓글 표시
I have a data file with the following format (schematic):
header text 1
header text 2
header text 3
x1 x2 x3 x4 x4 x6 ... xn
1.200e-4 2.800e+3 4.512e+2 ... 8.903e+3
.
.
.
2.210e-4 2.800e+3 4.533e+2 ... 8.997e+3
In the above, the data (matrix) has an unknown number of rows and columns. I use the following command:
A = textscan(filename,formatSpec,'HeaderLines',4,'Delimiter',' ');
How to describe formatSpec in this case?
댓글 수: 1
Rik
2017년 2월 9일
read the file once to find out n (e.g. by counting the spaces in the 4th line), and then use repmat('%e3 ',n,1)
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Large Files and Big Data에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!