4.83333

4.8 | 6 ratings Rate this file 106 downloads (last 30 days) File Size: 578 Bytes File ID: #3123

robustreadcsv

by Michael Robbins

 

13 Mar 2003 (Updated 18 Mar 2003)

No BSD License  

CSVREAD for files with varying number of cols.

Download Now | Watch this File

File Information
Description

If you have a file that has more commas in some lines than others, this is for you.

It's very simple, but it may help some of you.

MATLAB release MATLAB 6.1 (R12.1)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (6)
01 Apr 2004 Ricardo Pachon

Indeed, it can help you! Perhaps you must add a few lines so it fits your needs, but it will work fine.

28 Feb 2005 Francis Pieraut

Great! This function should be include by defalut in matlab. It works perfectly.

15 Jan 2006 Dan Don

Simple and effective

17 Feb 2006 Chris Zhou

Excellent reader, but consume too much memory for large files

21 Oct 2008 Michael Koelemay

This function is indeed really great, and robust.

I added 1 line to hugely boost performance by preallocating the output array "MM". To do this, just add this line right before the "for" loop:

MM=cell(length(M),max(cellfun(@length,regexp(M,','))));

19 Mar 2009 Sahin Aktas  
Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
data import Michael Robbins 22 Oct 2008 06:58:05
data export Michael Robbins 22 Oct 2008 06:58:05
read Michael Robbins 22 Oct 2008 06:58:05
csv Michael Robbins 22 Oct 2008 06:58:05
dlmread Michael Robbins 22 Oct 2008 06:58:05
csvread Michael Robbins 22 Oct 2008 06:58:05
file Michael Robbins 22 Oct 2008 06:58:05
io Michael Robbins 22 Oct 2008 06:58:05
delimited Michael Robbins 22 Oct 2008 06:58:05
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com