Set or query location of camera target
camtarget returns the location of the camera target in the current axes. The camera target is the location in the axes that the camera points to. The camera remains oriented toward this point regardless of its position.
camtarget([camera_target]) sets the camera target in the current axes to the specified value. Specify the target as a three-element vector containing the x-, y-, and z-coordinates of the desired location in the data units of the axes.
Move the camera position and the camera target along the x-axis in a series of steps:
surf(peaks); axis vis3d xp = linspace(-150,40,50); xt = linspace(25,50,50); for i=1:50 campos([xp(i),25,5]); camtarget([xt(i),30,0]) drawnow end