How do I control the Azimuth and Declination view angles of a 3D Plot?

조회 수: 2 (최근 30일)
Say I generate a GUI which has a 3d Plot/Surf in it. I want to know the best way to add user controls to manipulate the angle of view for the plot. Ie. the azimuth and declination.
I've had a look at axes properties, in order to try to get an understanding of the method in which MATLAB defines the view of a 3d plot. It seems to define a CameraPosition and "Up-Axis".
I was wondering if there's a quick and simple way to change the view without having to activate MATLAB's own 3DRotate within the figure?
Attached is some simple code below, which show's roughly what I'm on about. Ideally I'd like to create callback functions for the 2 sliders (s1 and s2) in order to alter the view accordingly.
%%QUICK EXAMPLE
%%Plot Data
a=rand(10); %Random Matrix
f=figure(); %Figure Window
s=surf(a); %Surface Plot
ax=gca; %Get Axis Handle
%%Add Sliders
s1=uicontrol('Style','Slider','Units','Normalized','Position',...
[0.05,0.05,0.3,0.05],'Tag','Azimuth','Min',-180,'Max',180,...
'Value',0);
s2=uicontrol('Style','Slider','Units','Normalized','Position',...
[0.65,0.05,0.3,0.05],'Tag','Declination','Min',-90,'Max',90,...
'Value',0);
Thanks,
Gav

채택된 답변

Sean de Wolski
Sean de Wolski 2012년 10월 24일
I think you're trying to hard:

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by