Large CSV table (2 dimension) imports into a single column
Mostrar comentarios más antiguos
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 comentarios
Andy L
el 12 de Ag. de 2014
Can you provide the code you have used?
Andrew
el 12 de Ag. de 2014
per isakson
el 12 de Ag. de 2014
It might have something to do with the exceptionally long lines. However, I cannot find in the documentation.
Andy L
el 12 de Ag. de 2014
No me neither! I cannot recreate it either, thanks to the memory limitation of my machine.
dpb
el 12 de Ag. de 2014
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
el 12 de Ag. de 2014
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
el 12 de Ag. de 2014
dpb
el 12 de Ag. de 2014
... 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.
Respuestas (0)
Categorías
Más información sobre Get Started with MATLAB en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!