Hi Dobril,
The data for any figure can be found in the figure properties. To see the properties use an handle that refers to the figure.
Example showcasing the usage of a handel to access figure properties:
[X, Y] = meshgrid(linspace(-5, 5, 100), linspace(-5, 5, 100));
fittedSurface = fit([X(:), Y(:)], Z(:), 'poly22');
z=plot(fittedSurface)
z =
Surface (curvefit.gui.FunctionSurface) with properties:
EdgeColor: [0 0 0]
LineStyle: '-'
FaceColor: 'flat'
FaceLighting: 'flat'
FaceAlpha: 1
XData: [51x49 double]
YData: [51x49 double]
ZData: [51x49 double]
CData: [51x49 double]
Use GET to show all properties
z.ZData
ans =
50.0000 47.9601 46.0069 44.1406 42.3611 40.6684 39.0625 37.5434 36.1111 34.7656 33.5069 32.3351 31.2500 30.2517 29.3403 28.5156 27.7778 27.1267 26.5625 26.0851 25.6944 25.3906 25.1736 25.0434 25.0000 25.0434 25.1736 25.3906 25.6944 26.0851
48.0400 46.0001 44.0469 42.1806 40.4011 38.7084 37.1025 35.5834 34.1511 32.8056 31.5469 30.3751 29.2900 28.2917 27.3803 26.5556 25.8178 25.1667 24.6025 24.1251 23.7344 23.4306 23.2136 23.0834 23.0400 23.0834 23.2136 23.4306 23.7344 24.1251
46.1600 44.1201 42.1669 40.3006 38.5211 36.8284 35.2225 33.7034 32.2711 30.9256 29.6669 28.4951 27.4100 26.4117 25.5003 24.6756 23.9378 23.2867 22.7225 22.2451 21.8544 21.5506 21.3336 21.2034 21.1600 21.2034 21.3336 21.5506 21.8544 22.2451
44.3600 42.3201 40.3669 38.5006 36.7211 35.0284 33.4225 31.9034 30.4711 29.1256 27.8669 26.6951 25.6100 24.6117 23.7003 22.8756 22.1378 21.4867 20.9225 20.4451 20.0544 19.7506 19.5336 19.4034 19.3600 19.4034 19.5336 19.7506 20.0544 20.4451
42.6400 40.6001 38.6469 36.7806 35.0011 33.3084 31.7025 30.1834 28.7511 27.4056 26.1469 24.9751 23.8900 22.8917 21.9803 21.1556 20.4178 19.7667 19.2025 18.7251 18.3344 18.0306 17.8136 17.6834 17.6400 17.6834 17.8136 18.0306 18.3344 18.7251
41.0000 38.9601 37.0069 35.1406 33.3611 31.6684 30.0625 28.5434 27.1111 25.7656 24.5069 23.3351 22.2500 21.2517 20.3403 19.5156 18.7778 18.1267 17.5625 17.0851 16.6944 16.3906 16.1736 16.0434 16.0000 16.0434 16.1736 16.3906 16.6944 17.0851
39.4400 37.4001 35.4469 33.5806 31.8011 30.1084 28.5025 26.9834 25.5511 24.2056 22.9469 21.7751 20.6900 19.6917 18.7803 17.9556 17.2178 16.5667 16.0025 15.5251 15.1344 14.8306 14.6136 14.4834 14.4400 14.4834 14.6136 14.8306 15.1344 15.5251
37.9600 35.9201 33.9669 32.1006 30.3211 28.6284 27.0225 25.5034 24.0711 22.7256 21.4669 20.2951 19.2100 18.2117 17.3003 16.4756 15.7378 15.0867 14.5225 14.0451 13.6544 13.3506 13.1336 13.0034 12.9600 13.0034 13.1336 13.3506 13.6544 14.0451
36.5600 34.5201 32.5669 30.7006 28.9211 27.2284 25.6225 24.1034 22.6711 21.3256 20.0669 18.8951 17.8100 16.8117 15.9003 15.0756 14.3378 13.6867 13.1225 12.6451 12.2544 11.9506 11.7336 11.6034 11.5600 11.6034 11.7336 11.9506 12.2544 12.6451
35.2400 33.2001 31.2469 29.3806 27.6011 25.9084 24.3025 22.7834 21.3511 20.0056 18.7469 17.5751 16.4900 15.4917 14.5803 13.7556 13.0178 12.3667 11.8025 11.3251 10.9344 10.6306 10.4136 10.2834 10.2400 10.2834 10.4136 10.6306 10.9344 11.3251
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
When we call plot(fittedSurface), MATLAB returns a handle to the surface plot. We can capture this handle in a variable (z in the example). Once we have the handle, we can access the ZData property directly.
Hope it helps.