Large CSV table (2 dimension) imports into a single column
古いコメントを表示
I have a large csv file (100001 x 1000), with no headers. When I import using either csvread or dlmread matlab produces a variable that is 100001000 x 1.
I have tried on multiple machines and same thing happens.
CSV file size is confirmed using script: awk -F, 'END {printf "Number of Rows : %s\nNumber of Columns = %s\n", NR, NF}' file.csv
Edit: if I read the csv file, reshape it to 100001x1000, write it to a new csv file, and then read the new file, the new file, when imported to matlab, is a single column vecotr.
8 件のコメント
Andy L
2014 年 8 月 12 日
Can you provide the code you have used?
Andrew
2014 年 8 月 12 日
per isakson
2014 年 8 月 12 日
It might have something to do with the exceptionally long lines. However, I cannot find in the documentation.
Andy L
2014 年 8 月 12 日
No me neither! I cannot recreate it either, thanks to the memory limitation of my machine.
dpb
2014 年 8 月 12 日
Which release, which OS?
As another says, can't produce as large a file here for memory constraints but no issue (other than takes a long time to write a big formatted file) with as large as cared to go w/ the re-read file being same dimension as written given my limited patience to wait.
If this is reproducible, I'd suggest halving down the size until it no longer happens (easy enough to do w/ just random data in a loop) and then working back until it does to see if can isolate the magic number/size.
Then, if that doesn't provide enough clues as to what's happening to solve the problem for some other reason, submit an official bug report to TMW at www.mathworks.com
Image Analyst
2014 年 8 月 12 日
You forgot to attach the file! Please chop off all but 10 lines or so and attach the file with the paper clip icon so people can test code with your actual data.
Andrew
2014 年 8 月 12 日
dpb
2014 年 8 月 12 日
... I simply used the load command rather than a reader.
If there's nothing otherwise peculiar in the file, it needs to be submitted as a bug report as noted above. One presumes there must be something unique in either newline and/or the delimiter to cause the problem but until actually attach the file can't tell anything more.
I'd wonder why you wouldn't use a stream or other much more compact form for file transfer for such large file sizes, however. Performance would have to go up greatly it would seem.
回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Get Started with MATLAB についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!