Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
rotate objeck in GUI

Subject: rotate objeck in GUI

From: wahyoe Unggul

Date: 31 May, 2011 19:04:04

Message: 1 of 1

how do I set the following script with tooglebutton control, if the button is pressed, the object will rotate and if the press again the object will stop spinning

x = [0 1 1 0 ];
y = [0 0 1 1 ];
z = [0 0 0 0 ];

cube_h = plot3(x-0.5,y-0.5,z-0.5);
axis('square');
axis([-1 1 -1 1 -1 1]*2);
view(-37.5,15);
set(cube_h)
rotation_increment = 0.1; % degrees
rotation_axis = [0 0 1];
rotation_origin = [0 0 0];
num_of_incr = 360/rotation_increment;
for loop = 1:num_of_incr
rotate(cube_h,rotation_axis,...
rotation_increment,rotation_origin);
drawnow;
end

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us