1
votes

I have made a contour plot in matlab using the inbuilt contour function. It plots a group of lines in a figure, each of which represents a contour. I would like to obtain the data points that comprise each of these contours. How can I do this?

So given a contour plot how would I get the actual underlying data points that make up the equation for each contour line. For example, if the contours ended up being straight lines and one of the contour lines went through the origin, I would like to be able to obtain data points that describe this line. e.g. [0 0.1 0.2 0.3 0.4 ; 0 0.25 0.5 0.75 1].

Thanks.

1

1 Answers

0
votes

[C,h] = contour(...) returns a contour matrix, C, that contains the x, y coordinates and contour levels for contour lines derived by the low-level contourc function, and a handle, h, to a contourgroup object. The clabel function uses contour matrix C to label the contour lines. ContourMatrix is also a read-only contourgroup property that you can obtain from the returned handle. If X or Y is irregularly spaced, contour calculates contours using a regularly spaced contour grid, and then transforms the data to X or Y.

By the way, this text was taken from Matlab documentation...