Azzera filtri
Azzera filtri

Making a countor map from a excel file

1 visualizzazione (ultimi 30 giorni)
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

Risposta accettata

Fangjun Jiang
Fangjun Jiang il 2 Ago 2011
[Num,Txt,Raw]=xlsread('MyData.xls');
x=Num(:,1);
y=Num(:,2);
z=Num(:,3);
contour(x,y,z);
  1 Commento
Chaklader Asfak
Chaklader Asfak il 5 Ago 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.

Accedi per commentare.

Più risposte (1)

Friedrich
Friedrich il 5 Ago 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.

Categorie

Scopri di più su Contour Plots in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by