Be the first to rate this file! 27 Downloads (last 30 days) File Size: 33.2 KB File ID: #43162
image thumbnail

C2xyz contour matrix to coordinates



21 Aug 2013 (Updated )

Convert values given by a contour matrix to easy-to-use cells.

| Watch this File

File Information

These functions simply reshape the contour matrix C into something a little more user friendly.

[x,y,z] = C2xyz(C) returns the x and y coordinates of contours in a contour matrix and their corresponding z values. C is the contour matrix given by the contour function.

EXAMPLE 1: You have a contour plot and and you want to know the (x,y) coordinates of the contours, as well as the z value corresponding to each contour line.

C = contour(peaks);
[x,y,z] = C2xyz(C); %<--THIS IS THE FUNCTION

This returns 1 x numberOfContourLines cells of x values and y values, and their corresponding z values are given in a 1 x numberOfContourLines array.

EXAMPLE 2: You have some data and you're interested in the z = 3 isopleth. But where in (x,y) coordinates does z equal 3?

C = contour(peaks,[3 3]);

Note: You can always use C2xyz, even if you do not have a z output. C2xy is only included here because it may be marginally faster, and easier to remember its name if you're not thinking about z values.

Required Products MATLAB
MATLAB release MATLAB 8.0 (R2012b)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
22 Aug 2013

Updated description text.

Contact us