Matlab 2016a cannot read the columns in csv file but Matlab 2015a can
Show older comments
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
Mason Greer
on 27 Dec 2016
Answers (2)
Walter Roberson
on 27 Dec 2016
The file is tab delimited.
dlmread('planarData.txt', '\t')
or
readtable('planarData.txt')
Image Analyst
on 27 Dec 2016
0 votes
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
Walter Roberson
on 27 Dec 2016
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.
Categories
Find more on Data Import and Analysis in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!