Patch moving with keyboard

5 visualizaciones (últimos 30 días)
Ilia Sumatochin
Ilia Sumatochin el 26 de Abr. de 2016
Respondida: Kevin Moerman el 26 de Abr. de 2016
Hi all, I have a little problem. I have created the patch object in a figure with an axes and then i have placed it at some location using the transformation. Now i want to move it using the arrows or an any other button on my keyboard.
Here is an example:
function[] = main()
fig....
ax...
set(Fig,'KeyPressFcn',@KeybordMoving);
end
function[] = patch()
t=0:pi/2:2*pi;
x=cos(t);
y=sin(t):
handle=patch(x,y,[0 0 0]);
Tx=-1;
T=makehgtform('translate', [Tx 0 0]);
M=T;
AxT=hgtransform('parent', gca, 'matrix', M);
end
function[] = KeboardMoving(hobject, event)
switch event.Key
case 'something'
case 'something'
end
end
Each press on key i would like to move it left or right. thanks for help.

Respuestas (1)

Kevin Moerman
Kevin Moerman el 26 de Abr. de 2016

Community Treasure Hunt

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

Start Hunting!

Translated by