Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
contour plot from excel table

Subject: contour plot from excel table

From: Khanh

Date: 9 Aug, 2010 18:59:06

Message: 1 of 7

If I have an excel file such as:
A B C
1 1 14
1 2 43
1 3 24
2 1 25
2 2 87
2 3 3
3 1 23
3 2 34
3 3 7

How can I make a contour plot of A, B, and C? I tried different methods that I found online but doesn't work. Please show me a simple way to do this.

Subject: contour plot from excel table

From: Sean

Date: 9 Aug, 2010 19:10:21

Message: 2 of 7

"Khanh " <kdcung@mtu.edu> wrote in message <i3pj5q$d4g$1@fred.mathworks.com>...
> If I have an excel file such as:
> A B C
> 1 1 14
> 1 2 43
> 1 3 24
> 2 1 25
> 2 2 87
> 2 3 3
> 3 1 23
> 3 2 34
> 3 3 7
>
> How can I make a contour plot of A, B, and C? I tried different methods that I found online but doesn't work. Please show me a simple way to do this.

If I understand you properly (a big if)
% 1 1 14
% 1 2 43
% 1 3 24
% 2 1 25
% 2 2 87
% 2 3 3
% 3 1 23
% 3 2 34
% 3 3 7

val = [14
43
24
25
87
3
23
34
7];

val = reshape(val,3,3)';
contour(val);

Subject: contour plot from excel table

From: Khanh

Date: 9 Aug, 2010 19:28:04

Message: 3 of 7

Sean,
your answer works for the hypothetical problem that I posted. But what I was really looking for is to have A, B values on the axis.
Another way to say is, if I have
A=[1 3 6 8 1 3 6 8]
B=[1 1 1 1 2 2 2 2]
C=[3 6 2 8 3 5 3 6]
how Contour(A,B,C)??

Subject: contour plot from excel table

From: Walter Roberson

Date: 9 Aug, 2010 19:35:59

Message: 4 of 7

Khanh wrote:

> your answer works for the hypothetical problem that I posted. But what I
> was really looking for is to have A, B values on the axis.
> Another way to say is, if I have
> A=[1 3 6 8 1 3 6 8]
> B=[1 1 1 1 2 2 2 2]
> C=[3 6 2 8 3 5 3 6]
> how Contour(A,B,C)??

With difficulty.

I suggest you consider using gridfit
http://www.mathworks.com/matlabcentral/fileexchange/8998-surface-fitting-using-gridfit

Subject: contour plot from excel table

From: Sean

Date: 9 Aug, 2010 19:40:22

Message: 5 of 7

"Khanh " <kdcung@mtu.edu> wrote in message <i3pks4$2h5$1@fred.mathworks.com>...
> Sean,
> your answer works for the hypothetical problem that I posted. But what I was really looking for is to have A, B values on the axis.
> Another way to say is, if I have
> A=[1 3 6 8 1 3 6 8]
> B=[1 1 1 1 2 2 2 2]
> C=[3 6 2 8 3 5 3 6]
> how Contour(A,B,C)??

A=[1 3 6 8 1 3 6 8]
B=[1 1 1 1 2 2 2 2]
C=[3 6 2 8 3 5 3 6]

[rr cc] = meshgrid([1 2],[1 3 6 8])
contour(rr,cc,reshape(C,4,2))

Do you mean this? You still haven't specified _exactly_ what you expect.

Or do you mean this:
contour([A.',B.'],C)

It's very difficult to gauge what you want.

Subject: contour plot from excel table

From: Khanh

Date: 13 Aug, 2010 20:28:23

Message: 6 of 7

"Sean " <sean.dewolski@nospamplease.umit.maine.edu> wrote in message <i3plj6$ich$1@fred.mathworks.com>...
> "Khanh " <kdcung@mtu.edu> wrote in message <i3pks4$2h5$1@fred.mathworks.com>...
> > Sean,
> > your answer works for the hypothetical problem that I posted. But what I was really looking for is to have A, B values on the axis.
> > Another way to say is, if I have
> > A=[1 3 6 8 1 3 6 8]
> > B=[1 1 1 1 2 2 2 2]
> > C=[3 6 2 8 3 5 3 6]
> > how Contour(A,B,C)??
>
> A=[1 3 6 8 1 3 6 8]
> B=[1 1 1 1 2 2 2 2]
> C=[3 6 2 8 3 5 3 6]
>
> [rr cc] = meshgrid([1 2],[1 3 6 8])
> contour(rr,cc,reshape(C,4,2))
>
> Do you mean this? You still haven't specified _exactly_ what you expect.
>
> Or do you mean this:
> contour([A.',B.'],C)
>
> It's very difficult to gauge what you want.

Sean,
Can you explain the difference between these two method? I want to use the second method.

Subject: contour plot from excel table

From: Richard

Date: 26 Aug, 2013 21:44:12

Message: 7 of 7

To create a contour plot with contour lines in Excel, try Contour Plot at www.OfficeExpander.com
There is a demo version to try.
Cheers.

"Khanh" wrote in message <i3pj5q$d4g$1@fred.mathworks.com>...
> If I have an excel file such as:
> A B C
> 1 1 14
> 1 2 43
> 1 3 24
> 2 1 25
> 2 2 87
> 2 3 3
> 3 1 23
> 3 2 34
> 3 3 7
>
> How can I make a contour plot of A, B, and C? I tried different methods that I found online but doesn't work. Please show me a simple way to do this.

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us