Matlab 2016a cannot read the columns in csv file but Matlab 2015a can

Hello all,
I am trying to use csvread to read in a space delimited txt file. The function works fine in Matlab 2015a but when I try to use it in 2016a it only reads in the first column. Does anyone know what could be going on? I have attached a sample csv file and my current code.
function [ map ] = displayGradientMap( path )
data = csvread(path);
x = linspace(0,9,76);
y = linspace(0,8.75,76);
figure(5);
imagesc(x,y,data);
colorbar
map = data;
end

1 Comment

I have fixed the problem by exporting my data as comma delimited. I am still curious as to why it worked with Matlab 2015 and not 2016 though.

Sign in to comment.

Answers (2)

The file is tab delimited.
dlmread('planarData.txt', '\t')
or
readtable('planarData.txt')
It doesn't look like a standard rectangular matrix. There are different numbers of numbers on each line. And anyway, it's not even a CSV file because there are not commas between the numbers there is white space. Perhaps dlmread() might have worked but that still needs rectangular matrices, not ones with ragged right edges.

1 Comment

Each line does have the same number of columns, 76.
But it uses tabs, so minor changes in column content width can result in big changes in visible output.

Sign in to comment.

Categories

Find more on Data Import and Analysis in Help Center and File Exchange

Tags

Asked:

on 27 Dec 2016

Commented:

on 27 Dec 2016

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!