I’m not exactly certain what the desired result is, however in a surf plot for example, the surface object hass the information —
[X,Y,Z] = peaks;
figure
hs = surf(X, Y, Z) % Create Handle To 'surface' Object
hs =
Surface with properties:
EdgeColor: [0 0 0]
LineStyle: '-'
FaceColor: 'flat'
FaceLighting: 'flat'
FaceAlpha: 1
XData: [49×49 double]
YData: [49×49 double]
ZData: [49×49 double]
CData: [49×49 double]
Show all properties
grid on
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/834850/image.png)
So for example to get the ‘ZData’ matrix —
Z_surf = hs.ZData
Z_surf = 49×49
0.0001 0.0001 0.0002 0.0004 0.0007 0.0011 0.0017 0.0025 0.0034 0.0043 0.0051 0.0052 0.0042 0.0010 -0.0050 -0.0151 -0.0299 -0.0500 -0.0752 -0.1049 -0.1373 -0.1703 -0.2010 -0.2268 -0.2450 -0.2539 -0.2527 -0.2419 -0.2228 -0.1976
0.0001 0.0002 0.0004 0.0006 0.0010 0.0017 0.0026 0.0037 0.0051 0.0064 0.0073 0.0070 0.0046 -0.0013 -0.0123 -0.0299 -0.0555 -0.0898 -0.1327 -0.1828 -0.2373 -0.2924 -0.3437 -0.3862 -0.4161 -0.4302 -0.4276 -0.4087 -0.3761 -0.3332
0.0002 0.0003 0.0005 0.0009 0.0016 0.0025 0.0038 0.0055 0.0074 0.0091 0.0101 0.0091 0.0045 -0.0059 -0.0244 -0.0537 -0.0959 -0.1520 -0.2217 -0.3028 -0.3908 -0.4795 -0.5616 -0.6296 -0.6769 -0.6989 -0.6937 -0.6625 -0.6090 -0.5392
0.0002 0.0004 0.0008 0.0014 0.0023 0.0036 0.0055 0.0079 0.0105 0.0128 0.0138 0.0116 0.0037 -0.0131 -0.0427 -0.0889 -0.1549 -0.2425 -0.3510 -0.4767 -0.6130 -0.7502 -0.8769 -0.9816 -1.0541 -1.0873 -1.0784 -1.0292 -0.9456 -0.8368
0.0003 0.0006 0.0011 0.0019 0.0032 0.0051 0.0077 0.0110 0.0147 0.0178 0.0188 0.0150 0.0028 -0.0227 -0.0671 -0.1362 -0.2346 -0.3648 -0.5260 -0.7127 -0.9150 -1.1186 -1.3066 -1.4619 -1.5692 -1.6183 -1.6047 -1.5311 -1.4063 -1.2440
0.0004 0.0008 0.0015 0.0026 0.0044 0.0070 0.0106 0.0151 0.0201 0.0244 0.0257 0.0204 0.0031 -0.0328 -0.0955 -0.1931 -0.3322 -0.5166 -0.7450 -1.0101 -1.2975 -1.5872 -1.8552 -2.0768 -2.2305 -2.3012 -2.2825 -2.1782 -2.0008 -1.7696
0.0005 0.0010 0.0019 0.0034 0.0058 0.0093 0.0141 0.0203 0.0272 0.0333 0.0357 0.0294 0.0074 -0.0396 -0.1224 -0.2521 -0.4382 -0.6860 -0.9942 -1.3531 -1.7436 -2.1385 -2.5050 -2.8095 -3.0220 -3.1215 -3.0991 -2.9593 -2.7192 -2.4049
0.0007 0.0013 0.0024 0.0043 0.0073 0.0118 0.0182 0.0266 0.0361 0.0451 0.0500 0.0445 0.0197 -0.0364 -0.1379 -0.2995 -0.5340 -0.8491 -1.2440 -1.7066 -2.2129 -2.7277 -3.2083 -3.6104 -3.8941 -4.0312 -4.0090 -3.8328 -3.5242 -3.1175
0.0007 0.0015 0.0028 0.0051 0.0088 0.0145 0.0227 0.0337 0.0468 0.0603 0.0698 0.0684 0.0452 -0.0146 -0.1285 -0.3154 -0.5921 -0.9694 -1.4478 -2.0139 -2.6390 -3.2799 -3.8835 -4.3937 -4.7596 -4.9441 -4.9299 -4.7220 -4.3468 -3.8464
0.0008 0.0015 0.0030 0.0056 0.0100 0.0168 0.0270 0.0410 0.0588 0.0785 0.0959 0.1035 0.0888 0.0350 -0.0791 -0.2766 -0.5790 -1.0012 -1.5465 -2.2015 -2.9344 -3.6950 -4.4203 -5.0422 -5.4980 -5.7407 -5.7466 -5.5195 -5.0892 -4.5057
.