Patch moving with keyboard
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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.
0 commentaires
Réponses (1)
Voir également
Catégories
En savoir plus sur Polygons dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!