Importing big .ASC file
이전 댓글 표시
Good morning, I searched on the web but I din't find anything useful for me.
I have a big .ASC file that begins like this:
Time 1 - default sample rate [s] MX840A_0_CH 1 [µm/m] MX840A_0_CH 2 [µm/m] MX840A_0_CH 3 [µm/m] MX840A_0_CH 4 [µm/m] MX840A_0_CH 5 [µm/m] MX840A_0_CH 6 [µm/m] MX840A_0_CH 7 [µm/m] MX840A_0_CH 8 [µm/m] Time 2 - default sample rate [s] Time 2 - fast sample rate [s] MX410_0_CH 1 [µm/m] MX410_1_CH 2 [g]
0 0,1980 0,3258 -0,2376 -0,5230 1,680 -0,1286 -0,3765 -0,2802 0 0 0,2373 -0,00105
0,00083 0,07124 0,3033 -0,04901 -0,4132 1,524 0,05268 -0,2449 -0,1356 0,00083 0,00021 0,2639 -0,00067
0,00167 0,05543 0,2692 0,05971 -0,3727 1,215 0,2908 -0,1258 -0,1223 0,00167 0,00042 0,3119 0,000
0,00250 0,1738 0,2790 0,2098 -0,3734 0,7158 0,1389 -0,1260 -0,1299 0,00250 0,00063 0,3839 0,00058
0,00333 0,2204 0,2843 0,3669 -0,2345 0,3564 0,09048 0,01820 -0,04594 0,00333 0,00083 0,3732 0,00080
...
It is basically n x 13 matrix with a big "n" (millions of rows).
I would like to import all these data in a suitable file for Matlab. I tried with the code:
filename = 'myfile01.txt';
delimiterIn = ' ';
headerlinesIn = 1;
A = importdata(filename,delimiterIn,headerlinesIn);
The result of this simple script (A) is only a 1x1 cell. I can't understand what I am missing. I would like to handle this data in Matlab then, in order to perform an analysis.
Thank you for your help!
댓글 수: 4
Ive J
2020년 7월 30일
Have you tried datastore?
doc tabularTextDatastore
Walter Roberson
2020년 7월 30일
Do you have enough memory that you could read in the entire file as text?
importdata() is not going to understand using comma as decimal separator. readtable() would be more likely to understand it -- or you could read the file as text, replace the comma with decimal point, and then textscan() the characters.
Guglielmo Giambartolomei
2020년 7월 30일
Guglielmo Giambartolomei
2020년 7월 30일
채택된 답변
추가 답변 (1개)
Guglielmo Giambartolomei
2020년 7월 31일
0 개 추천
댓글 수: 2
Walter Roberson
2020년 7월 31일
T{:, ColumnNumber}
or you can use table2array() but I have not found that to fit into my style.
Guglielmo Giambartolomei
2020년 8월 3일
카테고리
도움말 센터 및 File Exchange에서 Data Import and Analysis에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!