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!