|MATLAB Function Reference|
Position the camera to view an object or group of objects
views the objects identified in the vector
object_handles. The vector can contain the handles of axes children.
views the objects that are children of the axes identified by
views the objects that are in the current axes.
camlookat moves the camera position and camera target while preserving the relative view direction and camera view angle. The object (or objects) being viewed roughly fill the axes position rectangle.
camlookat sets the axes CameraPosition and CameraTarget properties.
This example creates three spheres at different locations and then progressively positions the camera so that each sphere is the object around which the scene is composed:
[x y z] =
sphere; s1 = surf(x,y,z); hold on s2 = surf(x+3,y,z+3); s3 = surf(x,y,z+6);
daspect([1 1 1])
camprojperspective camlookat(gca) % Compose the scene around the current axes pause(2) camlookat(s1) % Compose the scene around sphere
s1pause(2) camlookat(s2) % Compose the scene around sphere
s2pause(2) camlookat(s3) % Compose the scene around sphere
Controlling the Camera Viewpoint for related functions
Defining Scenes with Camera Graphics for more information