File Exchange

image thumbnail


version 1.0 (578 Bytes) by

CSVREAD for files with varying number of cols.



No License

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.

Comments and Ratings (8)


Dan (view profile)

Works great


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) ');'];

Sahin Aktas

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:


Chris Zhou

Excellent reader, but consume too much memory for large files

Dan Don

Simple and effective

Francis Pieraut

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

Ricardo Pachon

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

MATLAB Release
MATLAB 6.1 (R12.1)

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

» Watch video