The data used to plot either the surface and the dots are stored in the figure.
Therefore you can:
- open the figure
- get the data from the figure
- get the children of the figure, in thsi case the axes
- extract form the axes, the X, y, and z data of the surface
The axes actually contains two set of data:
- the data of the dots stored in the z(1)
XData, YData, ZData
- the data of the surface stored in the z(2)
XData, YData, ZData
This is the code (with "dot notation"):
% Open the figure
open('cubicinterp.fig')
% Get the data from the figure
x=gcf
% Get the children of the figure (in this case the axes)
y=x.Children
% Get the data used to plot on the axes
z=y.Children
figure
XX=z(2).XData;
YY=z(2).YData;
ZZ=z(2).ZData;
CCDD=z(2).CData;
surf(XX,YY,ZZ,CCDD)
return
This is the code without the "dot notation" (before R2014b)
% Open the figure
open('cubicinterp.fig')
% Get the data from the figure
x=gcf
% Get the children of the figure (in this case the axes)
y_1=get(gcf,'children');
% Get the data used to plot on the axes
z_1=get(y_1,'children');
figure
XX=get(z_1(2),'xdata');
YY=get(z_1(2),'ydata');
ZZ=get(z_1(2),'zdata');
CCDD=get(z_1(2),'Cdata');
surf(XX,YY,ZZ,CCDD)
This is the extracted surface:

Hope this helps.
Qapla'