subvolume

Extracts a rectangular part of a volume data set.

Category: Graphics > 2-D and 3-D Plots

Syntax

[Nx, Ny, Nz, NV] = subvolume(X, Y, Z, V, limits)

Returns the part of the volume inside limits.

[Nx, Ny, Nz, NV] = subvolume(V, limits)

Uses array indices as coordinates.

Description

The function keeps the grid points that fall inside the limits. It is typically used to isolate a region of interest before calling isosurface or slice.

Input arguments

X, Y, Z
Coordinate arrays of the same size as V.
V
3-D array of values.
limits
Six-element vector [xmin xmax ymin ymax zmin zmax]. Use NaN to leave a bound unchanged.

Output arguments

Nx, Ny, Nz
Coordinates of the extracted block.
NV
Values of the extracted block.

Example

A 2-by-2-by-2 block

[x, y, z] = meshgrid(1:4);
v = x + y + z;
[nx, ny, nz, nv] = subvolume(x, y, z, v, [2 3 2 3 2 3]);
disp(size(nv))
disp(nv(:)')
Output
     2     2     2
     6     7     7     8     7     8     8     9

See also

slice isosurface meshgrid reducevolume