Code covered by the BSD License  

Highlights from
Multi-Format CSV Reader

2.5

2.5 | 14 ratings Rate this file 45 Downloads (last 30 days) File Size: 1.77 KB File ID: #6012
image thumbnail

Multi-Format CSV Reader

by

 

07 Oct 2004 (Updated )

MFCSVREAD reads a CSV file containing both text & numeric data.

| Watch this File

File Information
Description

"mfcsvread" reads a CSV file containing both text & numeric data. MATLAB's CSVREAD function will work with all numeric, or all text data, but not both. It's common to have a file with a single line of comma separated text headers followed by many rows of numeric data. xlsread is limited in the number of rows & colums (actually, Excel is the limitation) it can read.

The CSV file should look like:
comma, separated, text, ...
1,2,3,4,5,...
6,7,8,9,10,...
etc...

The output is a structure with the column headers as fields in a structure, each with a vector of data.

MATLAB release MATLAB 7.0.1 (R14SP1)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (19)
13 Apr 2014 Bara'a

the description is indeed misleading ... it didn't work at all with my mixed data types in the csv file :(

18 May 2012 SpartanG72  
08 Mar 2012 Zambezy

It did not work from the file download but after copy and paste of the code it worked like a charm...

23 Jan 2012 John

Since this code doesnt work to read text-numeric mixed files, does anyone have any suggestions for reading these?

12 Jul 2011 Naren

This function is useless if you are trying to read the csv data that is mix of numbers and text. This doesn’t do much than just read a text header and rest of the data need to be 100% numeric.

20 Apr 2010 cdvddt cdvddt

I do not agree with other comments:
The script does what it says in the description : It reads CSV data into a struct, and it does it right and fast.

I agree that the name is a bit misleading, but come on : Just learn to read a description.

Anyawy, thanks to the Author : that's excatly what I needed.

13 Apr 2010 mathworks2011

very poor. as above

12 Oct 2008 esam youssef  
28 May 2008 Alfred Haeusler  
23 Mar 2008 Ranga Roy Koduru  
09 Feb 2008 Scott B.

Autodataread.m in the FEX will definitely read CSV files whose contents include a mix of numeric and text columns.

16 May 2006 Peder Axensten

If you need to read any kind of delimited text, use readtext (available here at File Exchange). Any mix of numbers and strings is handled.

19 Apr 2006 Antoine Viellard

I recommand this for text cvs files :
http://www.antoine-viellard.com/tools/CSVImport.html

03 Oct 2005 Manu Raghavan

Function can't read data that's sorted as text in some columns and numbers in others. It WILL NOT work unless you have entirely numeric data with only a single text row for headers.

03 Jun 2005 flo ben  
06 Apr 2005 joe patiani

I found something strange in the Matlab for csvread function. In Matlab R13 the function can recognize R and C option, but not in R12. This option in R12 can`t be use just ignored by matlab.It seem like the option is useless. Could it be a bug in R12 version

28 Feb 2005 Francis Pieraut

The description is missleading and the filename also. A more appropriate description should be mfcvsread read std csv with text columns name as the first row.

06 Jan 2005 Cole Stephens

The entire file can't be mixed. It's meant to read in a CSV file who's first row is text and all subsequent rows are numeric. It is documented in the help:

The CSV file should look like:
comma, separated, text, ...
1,2,3,4,5,...
6,7,8,9,10,...

14 Nov 2004 a matlab user

Could it be that the author posted the wrong file?

I could not get it to read a 'CSV file containing both text & numeric data' as advertised. In fact, the function calls CSVREAD:

%Read in the rest of the data (should be numeric)
fieldData=csvread(fileName,1,0);

so it can't seem to do anything CSVREAD can't do.

Updates
20 Oct 2010

Updated the license information.

Contact us