No BSD License  

Highlights from
robustreadcsv

4.71429

4.7 | 7 ratings Rate this file 10 Downloads (last 30 days) File Size: 578 Bytes File ID: #3123
image thumbnail

robustreadcsv

by

 

13 Mar 2003 (Updated )

CSVREAD for files with varying number of cols.

| 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   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (7)
03 Sep 2012 Jonathan

Adding this code to the end of the function makes a variable for each column. The name is taken from the first (header) row

data = MM;
clear MM;
for i=1:size(data,2)
cmd = ['MM.' data{1,i} ' = data(2:end,' num2str(i) ');'];
eval(cmd);
end

19 Mar 2009 Sahin Aktas  
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,','))));

17 Feb 2006 Chris Zhou

Excellent reader, but consume too much memory for large files

15 Jan 2006 Dan Don

Simple and effective

28 Feb 2005 Francis Pieraut

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

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.

Contact us