Main Content


Set or get roll angle of camera for Satellite Scenario Viewer

Since R2021a



camroll(viewer,roll) sets the roll angle of the camera for the Satellite Scenario Viewer. Setting the roll angle rotates the camera around its x-axis.

Camera with double-headed arrow around lens

outRoll = camroll(viewer,___) returns the roll angle of the camera. If the second input is roll, then the function sets the output equal to the input roll.


collapse all

Create a satellite scenario object.

sc = satelliteScenario;

Launch the Satellite Scenario Viewer.

v = satelliteScenarioViewer(sc);

Set the roll angle of the camera in the Satellite Scenario Viewer to 60 degrees.

roll = 60;      % degrees

Input Arguments

collapse all

Satellite Scenario Viewer, specified as a scalar satelliteScenarioViewer object.1

Roll angle of the camera in degrees, specified as a scalar in the range [–360, 360].

Output Arguments

collapse all

Camera roll angle in degrees, returned as a numeric scalar.


  • When the pitch angle is near –90 (the default value) or 90 degrees, the camera loses one rotational degree of freedom. As a result, when you change the roll angle, the heading angle might change instead. This phenomenon is called gimbal lock. To avoid the effects of gimbal lock, call the camheading function instead of the camroll function.

Version History

Introduced in R2021a

1 Alignment of boundaries and region labels are a presentation of the feature provided by the data vendors and do not imply endorsement by MathWorks®.