Get data from Contour plots

5 ビュー (過去 30 日間)
Lavkesh Lachhvani
Lavkesh Lachhvani 2011 年 6 月 8 日
Hi all,
I have been using matlab since quite long. I want to get data from the stored contour plot file. I can get it's handle using hggroup, but I don't know how to extract data from this ?
Can anybody help ?
thanx in advance..

回答 (4 件)

Walter Roberson
Walter Roberson 2011 年 6 月 9 日
The Children of the hggroup are a set of patches, one patch per contour level.
The patches are basically X/Y/Z lists of coordinates, with the Z originally set to be constant at the contour level. The transitions between the various regions of contouring are, if I recall correctly, done by sticking NaN in to the list of points where the breaks are.
After the utility routine constructs all of these patches, the contour() routine deliberately goes through and sets the Z coordinates for all of the patches to 0, destroying the original Z. Fortunately, the utility routine that constructed the layered patches also stored the patch level (Z coordinate) in the UserData field associated with the patch, so it is possible to determine which patch is which by looking at its UserData field.
The contour regions are sometimes quite irregular, especially if two regions with the same level touch each other: in such a case it is not certain that those two regions will be done through X1 NAN X2 NAN or if it will just build X1 X2 NAN.

Lavkesh Lachhvani
Lavkesh Lachhvani 2011 年 6 月 9 日
Thanks Walter for your explanation, I got the way to extract data, here it is...
plot1 = openfig('*.fig');
h1 = findall(plot1,'Type','hggroup');
X1 = get(h1(2),'XData');
Y1 = get(h1(2),'YData');
Z1 = get(h1(2),'ZData');

Roman Voronov
Roman Voronov 2013 年 2 月 12 日
This works for contour3, for contour the Z is empty

mohammad pourtousi
mohammad pourtousi 2013 年 5 月 7 日
Hello I have some single data based on x,y,z .I want to contour them. Actually x,y are show rectangular geometry and z shows pressure in this geometry.
How Can i contour them? Thanks

カテゴリ

Help Center および File ExchangeContour Plots についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by