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]);
[x,y] = C2xy(C); < THIS IS THE OTHER FUNCTION
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.
