- M = csvread(filename) reads a comma-separated value (CSV) formatted file into array M. The file must contain only numeric values. (Emphasis added.)
CSV Import doesn't show up properly?
7 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hey guys,
So I'm trying to import a timeseries from a csv file (dim roughly 210 x 175,000; corresponds to timepoints x voxels, file size roughly 572 MiB). When I load the file generated by my program into excel, it looks good and exactly how it should. However, when I load it into matlab, it imports as a (175000x210)x1 (ie, a 1 dimensional array whose dimensions are totally screwed up). Note that the file has a header column with the coordinates of each voxel, so I am loading the file as:
M = csvread('file/path/file.csv', 1, 0)
which should read starting at row index 1 and column index 0 (basically, just chop off the top row). why is it loading improperly into matlab? Note that in a smaller matrix that is created by the same program (200 MiB) the file loads properly and is, in that case, 210 x 50000 roughly (note that this matrix is about 3 times smaller). Is this a matlab error, or an error in creating the files? I did not actually write the code and the program is technically in a beta version, but I do not think they would screw up such a simple error, and it does load into excel just fine, it is only loading into matlab that gives it the dimensionality error. Any thoughts/suggestions?
0 Commenti
Risposte (2)
Star Strider
il 4 Apr 2015
Perhaps textscan would be preferable in your application.
Your choice.
1 Commento
Star Strider
il 4 Apr 2015
I suspect that it is reading the header as numeric variables, and could be confusing some of the header information as commas, or there could be additional commas in the header.
Consider using textscan if you cannot remove the header manually, and if you know the number of columns of data you have. (If there are ‘hundreds of thousands’ of columns, use repmat to create the format descriptor string.)
Vedere anche
Categorie
Scopri di più su Spreadsheets in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!