Effacer les filtres
Effacer les filtres

Get data from Contour plots

9 vues (au cours des 30 derniers jours)
Lavkesh Lachhvani
Lavkesh Lachhvani le 8 Juin 2011
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..

Réponses (4)

Walter Roberson
Walter Roberson le 9 Juin 2011
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 le 9 Juin 2011
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 le 12 Fév 2013
This works for contour3, for contour the Z is empty

mohammad pourtousi
mohammad pourtousi le 7 Mai 2013
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

Catégories

En savoir plus sur Contour Plots dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by