readtable of csv file with opts.DataLines =[n1 n2] and n1>2 doesn't work as expected
古いコメントを表示
Hello,
I'm trying to read a csv file by blocks, according to documentation, this shoudl work:
dir_load='some_dir';
file='some_file';
filename=fullfile(dir_load,file);
opts = detectImportOptions(filename);
opts.DataLines = [1 10];
T1=readtable(filename,opts);
opts.DataLines = [11 20];
T2=readtable(filename,opts);
opts.DataLines = [1 20];
T=readtable(filename,opts);
So, this T should be "[T1;T2]", but what i got is that T1 actually have lines 1 to 10 and T2 contains lines 6 to 15. What I'm doing wrong? You can find the file here.
T =
20x4 table
Var1 Var2 Var3 Var4
_____ _____ ____ _____
21.57 22.65 514 0.104
21.57 22.65 502 0.106
21.57 22.65 498 0.114
21.57 22.65 491 0.121
21.57 22.65 486 0.118
21.57 22.65 487 0.121
21.57 22.65 483 0.127
21.57 22.65 486 0.125
21.57 22.65 487 0.125
21.63 22.65 485 0.131
21.63 22.65 491 0.13
21.63 22.65 489 0.127
21.63 22.65 493 0.134
21.63 22.65 497 0.135
21.63 22.65 496 0.131
21.63 22.63 502 0.135
21.63 22.63 503 0.139
21.63 22.63 503 0.134
21.63 22.63 508 0.136
21.63 22.63 505 0.142
T1 =
10x4 table
Var1 Var2 Var3 Var4
_____ _____ ____ _____
21.57 22.65 514 0.104
21.57 22.65 502 0.106
21.57 22.65 498 0.114
21.57 22.65 491 0.121
21.57 22.65 486 0.118
21.57 22.65 487 0.121
21.57 22.65 483 0.127
21.57 22.65 486 0.125
21.57 22.65 487 0.125
21.63 22.65 485 0.131
T2 =
10x4 table
Var1 Var2 Var3 Var4
_____ _____ ____ _____
21.57 22.65 487 0.121
21.57 22.65 483 0.127
21.57 22.65 486 0.125
21.57 22.65 487 0.125
21.63 22.65 485 0.131
21.63 22.65 491 0.13
21.63 22.65 489 0.127
21.63 22.65 493 0.134
21.63 22.65 497 0.135
21.63 22.65 496 0.131
edited by Guillaume to attach the file to the question. Please don't use external file sharing sites
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Tables についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!