How can I make a button that rotates the object (around the z-axe). For example 5 degrees when you push the button.
Here is my code:
function geodata
% SIMPLE_GUI2 Select a data set from the pop-up menu and display
f = figure('Position',[300,300,450,285]);
h = [];
% Construct the components.
h(1) = uicontrol('Style','popupmenu',...
'String',{'Peaks','Membrane','Sinc'},...
'Position',[335,20,100,25],...
'Callback',@popup_menu_Callback);
h(2) = axes('Units','pixels','Position',[50,30,255,255]);
% Assure resize automatically.
f.Units = 'normalized';
set(h, 'Units', 'normalized');
set(h, 'FontSize', 12);
% Generate the data to plot.
peaks_data = peaks(35);
membrane_data = membrane;
[x,y] = meshgrid(-8:.5:8);
r = sqrt(x.^2+y.^2) + eps;
sinc_data = sin(r)./r;
% Create a plot in the axes.
current_data = peaks_data;
surf(current_data);
% Pop-up menu callback. Read the pop-up menu Value property to function popup_menu_Callback(source,eventdata)
% Determine the selected data set.
str = get(source, 'String');
val = get(source,'Value');
% Set current data to the selected data set.
switch str{val}
case 'Peaks' % User selects Peaks.
current_data = peaks_data;
case 'Membrane'
current_data = membrane_data;
case 'Sinc'
current_data = sinc_data;
end
surf(current_data);
end

답변 (1개)

Steven Lord
Steven Lord 2019년 10월 28일

0 개 추천

Either the view or camorbit functions likely will be of use to you.

카테고리

태그

질문:

2019년 10월 28일

답변:

2019년 10월 28일

Community Treasure Hunt

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

Start Hunting!

Translated by