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 data export

Subject: Contour data export

From: John Orwin

Date: 11 Jun, 2009 22:44:01

Message: 1 of 5

Hi there
I have a contourf plot of subsurface temperatures (0 down to 3 m depth at 0.1m intervals) over time - the matrix is set up as temperature (x axis) with depth (y axis) over 400 time steps (in the x direction). My issue is trying to export this data in a format that I can use to plot as a contour map in other software. Any suggestions would be gratefully received! Thanks.

Subject: Contour data export

From: TideMan

Date: 11 Jun, 2009 23:32:43

Message: 2 of 5

On Jun 12, 10:44 am, "John Orwin" <jfor...@gmail.com> wrote:
> Hi there
> I have a contourf plot of subsurface temperatures (0 down to 3 m depth at 0.1m intervals) over time - the matrix is set up as temperature (x axis) with  depth (y axis) over 400 time steps (in the x direction). My issue is trying to export this data in a format that I can use to plot as a contour map in other software. Any suggestions would be gratefully received! Thanks.

help contour

You will see that there is an output matrix c that contains all the
contours in a special format.

Subject: Contour data export

From: John Orwin

Date: 12 Jun, 2009 00:41:01

Message: 3 of 5

TideMan <mulgor@gmail.com> wrote in message <bb024f8b-0133-4fec-bf1f-71933d732695@b6g2000pre.googlegroups.com>...
> On Jun 12, 10:44?am, "John Orwin" <jfor...@gmail.com> wrote:
> > Hi there
> > I have a contourf plot of subsurface temperatures (0 down to 3 m depth at 0.1m intervals) over time - the matrix is set up as temperature (x axis) with ?depth (y axis) over 400 time steps (in the x direction). My issue is trying to export this data in a format that I can use to plot as a contour map in other software. Any suggestions would be gratefully received! Thanks.
>
> help contour
>
> You will see that there is an output matrix c that contains all the
> contours in a special format.

Thanks for this. You'll have to forgive my ignorance as I am a neophyte using Matlab. So using contourc gives me a two row output of, and I think I am right, the height of the contour or a point (z) in relation to a plane, x? I'm still at a bit of a loss as to how I can use this to generate the same contour plot in other graphing software (Golden Software's, Grapher). My apologies again for ignorant questions!

Subject: Contour data export

From: TideMan

Date: 12 Jun, 2009 00:49:41

Message: 4 of 5

On Jun 12, 12:41 pm, "John Orwin" <jfor...@gmail.com> wrote:
> TideMan <mul...@gmail.com> wrote in message <bb024f8b-0133-4fec-bf1f-71933d732...@b6g2000pre.googlegroups.com>...
> > On Jun 12, 10:44?am, "John Orwin" <jfor...@gmail.com> wrote:
> > > Hi there
> > > I have a contourf plot of subsurface temperatures (0 down to 3 m depth at 0.1m intervals) over time - the matrix is set up as temperature (x axis) with ?depth (y axis) over 400 time steps (in the x direction). My issue is trying to export this data in a format that I can use to plot as a contour map in other software. Any suggestions would be gratefully received! Thanks.
>
> > help contour
>
> > You will see that there is an output matrix c that contains all the
> > contours in a special format.
>
> Thanks for this. You'll have to forgive my ignorance as I am a neophyte using Matlab. So using contourc gives me a two row output of, and I think I am right, the height of the contour or a point (z) in relation to a plane, x? I'm still at a bit of a loss as to how I can use this to generate the same contour plot in other graphing software (Golden Software's, Grapher). My apologies again for ignorant questions!

Maybe your confusion is because you don't understand what a contour
is.
It is a curve in the x-y plane of a constant height z.
So the two row output gives you in the first column, the height of the
contour z, and below that the number of points in the contour, then
the x (top row) and y (bottom row) coordinates follow.
How you insert that information into other programs depends on what
they require as input. Undoubtedly, you'll have to write a
file..........

Subject: Contour data export

From: Steven Lord

Date: 12 Jun, 2009 13:46:56

Message: 5 of 5


"John Orwin" <jforwin@gmail.com> wrote in message
news:h0s86t$hr4$1@fred.mathworks.com...
> TideMan <mulgor@gmail.com> wrote in message
> <bb024f8b-0133-4fec-bf1f-71933d732695@b6g2000pre.googlegroups.com>...
>> On Jun 12, 10:44?am, "John Orwin" <jfor...@gmail.com> wrote:
>> > Hi there
>> > I have a contourf plot of subsurface temperatures (0 down to 3 m depth
>> > at 0.1m intervals) over time - the matrix is set up as temperature (x
>> > axis) with ?depth (y axis) over 400 time steps (in the x direction). My
>> > issue is trying to export this data in a format that I can use to plot
>> > as a contour map in other software. Any suggestions would be gratefully
>> > received! Thanks.
>>
>> help contour
>>
>> You will see that there is an output matrix c that contains all the
>> contours in a special format.
>
> Thanks for this. You'll have to forgive my ignorance as I am a neophyte
> using Matlab. So using contourc gives me a two row output of, and I think
> I am right, the height of the contour or a point (z) in relation to a
> plane, x?

The format of the contour matrix returned as the output of CONTOURC is
described in the Remarks section of the reference page for CONTOURC:

http://www.mathworks.com/access/helpdesk/help/techdoc/ref/contourc.html

So for instance, if the CONTOURC matrix was:

A = [0 1 2 4;
        3 5 7 6]

then this describes a contour for level 0 containing 3 points. Those points
are (1, 5), (2, 7) and (4, 6), so the contour is a triangle.

M = [0 1 2 4 10.5 7 2 9;
         3 5 7 6 3 1 2 3]

M describes two contours, one the triangle we described above and a second,
corresponding to level 10.5 containing 3 points. [I don't know if these two
contours overlap; I made them up very quickly as examples.]

> I'm still at a bit of a loss as to how I can use this to generate the same
> contour plot in other graphing software (Golden Software's, Grapher). My
> apologies again for ignorant questions!

I'm not familiar with those software packages or how they expect their data
to be formatted -- but hopefully with this explanation and your knowledge of
those other packages you can find some way to get the data into a format
they expect.

--
Steve Lord
slord@mathworks.com

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