Clear Filters
Clear Filters

Making a countor map from a excel file

1 view (last 30 days)
Dear all,
I have excell file with 3 coloums with some numbers. top of the each coloums there is the name of variable (say, x, y and z). Anyone could help me what will be the code to make countor from the file ?
The answer will be really helpfull.
regards-
Lemon leave

Accepted Answer

Fangjun Jiang
Fangjun Jiang on 2 Aug 2011
[Num,Txt,Raw]=xlsread('MyData.xls');
x=Num(:,1);
y=Num(:,2);
z=Num(:,3);
contour(x,y,z);
  1 Comment
Chaklader Asfak
Chaklader Asfak on 5 Aug 2011
Hello Fangjun Jiang,
Thanks for your answer. I tried to do the same with the data but it is showing some errors: Error using ==> contour at 73
Z must be size 2x2 or greater
Other time : Error - 65
Could you please write to me what is wrong here ?
Your answer will be really helpful.

Sign in to comment.

More Answers (1)

Friedrich
Friedrich on 5 Aug 2011
Hi,
since contour expects a matrix I would do:
[Num,Txt,Raw]=xlsread('MyData.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)
Maybe you have to make the steps bigger for the meshgrid command. This depends on the range of your x and y values.

Categories

Find more on Contour Plots 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!