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

2 Ansichten (letzte 30 Tage)
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

Akzeptierte Antwort

Sean de Wolski
Sean de Wolski am 24 Okt. 2012
I think you're trying to hard:

Weitere Antworten (0)

Kategorien

Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by