How to extract data from a pcolor figure?

37 views (last 30 days)
Hi all,
It's been a while that I'm struggling to extract data from a figure. I have the .fig file which contains x,y and z data in a pcolor shape. However, I don't have the data and I would like to collect it. I tried the following script:
hfig = openfig('myfig');
H = findobj(hfig,'type','surface');
x_data = get(H,'xdata');
y_data = get(H,'ydata');
z_data = get(H,'zdata');
I get the correct x and y data in the shape of a meshgrid. However, the zdata gives only 0 values. I guess the problem essentially comes from the 'type' of plot that I define as 'surface'. Any tip on it?

Accepted Answer

Walter Roberson
Walter Roberson on 11 Feb 2016
pcolor sets all of the ZData to 0. The color information is in the CData property.

More Answers (0)

Categories

Find more on Geographic Plots in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!