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 で Text Files についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!