MATLAB: Is the View property not updating correctly when I set the CameraPosition property

camerapositionMATLABview

I am setting the 'CameraPosition' property of my axes, but when I then examine the 'View' property using a "get" command, the angles have not been updated based on the new 'CameraPosition' values. How are 'CameraPosition' and 'View' related? 

Best Answer

The 'View' property on the Axes is affected by the 'CameraPosition' property; however, it does not get updated automatically when you call "get" on the 'View' property. When you call "get" on the camera properties, however, it does update all relevant fields (including 'View'). This is why some outputs from 
>> v = get(gca, 'View')
do not shown the correct, updated values.
To avoid this issue, you can add the following command before executing 'get(gca, 'View')':
>> drawnow
This will force an update of all fields (which will cause 'View' to update based on the new values you set for 'CameraPosition', for example).