# MATLAB: Finding surface height at x,y coordinates

evaluatingMapping Toolboxsurfm

Dear all,
using the mapping toolbox, I've created an interpolated surface from a scattered dataset. x,y,z are read from a file.
``[yi,xi] = meshgrid(min(y):0.5:max(y), min(x):0.5:max(x)); % sets up mesh grid for x/y coords, step-size=0.5zi = griddata(y,x,z,yi,xi,'linear'); % interpolates z valuessurfm(yi,xi,zi);``
Now, I need to read out the interpolated zi value at a given location (say… -10, -50). I feel like there's a very simple solution, but half an hour of googling and reading up in the documentation hasn't led me to success. Could someone point me in the right direction? Thank you!

``x = -30+60*rand(1000,1);y = -30+60*rand(1000,1);z = sin(x/10).*sin(y/15);``
``method = 'linear';extrap = 'none';S = scatteredInterpolant(x,y,z,method,extrap)``
``[yi,xi] = meshgrid(min(y):0.5:max(y), min(x):0.5:max(x)); % sets up mesh grid for x/y coords, step-size=0.5zi = S(xi,yi);  % <-- This is equivalent to zi = GRIDDATA(...)``
``S(-10,20)``