How can I get the 'light' in a 3d plot to appear in the generated code for a figure?

7 views (last 30 days)
I have a 3d plot and am using the 'Orbit Scene Camera Light' or the 'Toggle Scene Camera Light' options to change the position of the lighting on the image.
I want to save the final position of the light, so I select File > Generate Code. Usually, this shows me all the code necessary to regenerate the plot exactly as it sits. However, the light does not appear in the code, nor does it appear in the new plot that is created from executing the generated code.
Why is this the case?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 24 Nov 2020
Edited: MathWorks Support Team on 24 Nov 2020
Simply using the Camera Toolbar options for changing the lighting does not create a 'Light' object. In order to get the lighting to appear in the generated code for the figure, please first select 'Insert' and then select 'Light' from the drop-down menu.
'Orbit Scene Camera Light' can then be used to change the position of the light in addition to the property inspector which should appear to the right of the figure window. When you generate code, the lighting object will be present.

More Answers (0)

Categories

Find more on View and Analyze Simulation Results in Help Center and File Exchange

Tags

No tags entered yet.

Products


Release

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!