View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from
Multi-Format CSV Reader

2.7 | 15 ratings Rate this file 11 Downloads (last 30 days) File Size: 1.83 KB File ID: #6012 Version:

Multi-Format CSV Reader


Cole Stephens (view profile)


07 Oct 2004 (Updated )

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

| Watch this File

File Information

"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, ...

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 (20)
05 Dec 2016 Victor

Victor (view profile)

It did what I wanted: read the heading and construct a struct with fields based on the heading

13 Apr 2014 Bara'a

Bara'a (view profile)

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

John (view profile)

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

Comment only
12 Jul 2011 Naren

Naren (view profile)

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.

Comment only
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.

Comment only
19 Apr 2006 Antoine Viellard

I recommand this for text cvs files :

Comment only
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, ...

Comment only
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)

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

20 Oct 2010 1.1

Updated the license information.

01 Sep 2016

Updated license

Contact us