Creating a simple 2D contour plot from XYZ values from an excel table that I imported into Matlab

13 views (last 30 days)
Hello everyone, As mentioned in the heading - I'm having trouble using data in an excel table that I imported into Matlab to then plot up a visual 2D contours plan using that data (XYZ data) The main problem I am having is... "Subscripting a table using linear indexing (one subscript) or multidimensional indexing (three or more subscripts) is not supported. Use a row subscript and a variable subscript."
Data is attached
Any help greatly appreciated :)
  4 Comments
Guillaume
Guillaume on 25 May 2018
The problem is underneath in "" i.e It's telling me to use a row subscript and a variable subscript
Yes, you've told us the error you're getting but not what you're doing to get that error
Rhys Holmewood
Rhys Holmewood on 26 May 2018
Edited: Guillaume on 26 May 2018
Actually that's a good point. I was using this below code which another helpful member of the forum mentioned for a similar question...But really I have no idea what I'm doing...
[Num,Txt,Raw]=xlsread('contours.xls');
x=Num(:,1);
y=Num(:,2);
z=Num(:,3);
F = TriScatteredInterp(x,y,z)
[qx qy] = meshgrid(min(x):0.01:max(x),min(y):0.01:max(y))
qz = F(qx,qy);
contour(qx,qy,qz)

Sign in to comment.

Accepted Answer

Rhys Holmewood
Rhys Holmewood on 26 May 2018
Thanks all. I managed to achieve a satisfactory result using TeraPlot

More Answers (1)

Ameer Hamza
Ameer Hamza on 25 May 2018
Edited: Ameer Hamza on 25 May 2018
You can first convert the table into an array. For example
data = readtable('Contours.xls');
dataArray = table2array(data);
contourf(dataArray);

Categories

Find more on Graphics Performance in Help Center and File Exchange

Tags

Products


Release

R2018a

Community Treasure Hunt

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

Start Hunting!