%% Specify Interpolation Method
% Create a slice plane through volumetric data. Specify the interpolation method for the data values.
% Create a slice plane orthogonal to the x-axis at the value 0.8. Since the volume data is not defined for x values of 0.8, the slice function interpolates the nearby values. To use the nearest data point value, specify the interpolation method as 'nearest'.

[X,Y,Z] = meshgrid(-2:2);
V = X.*exp(-X.^2-Y.^2-Z.^2);
xslice = 0.8;   
yslice = [];
zslice = [];
slice(X,Y,Z,V,xslice,yslice,zslice,'nearest')

% Copyright 2012 The MathWorks, Inc.