Patch moving with keyboard

16 ビュー (過去 30 日間)
Ilia Sumatochin
Ilia Sumatochin 2016 年 4 月 26 日
回答済み: Kevin Moerman 2016 年 4 月 26 日
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.

回答 (1 件)

Kevin Moerman
Kevin Moerman 2016 年 4 月 26 日

カテゴリ

Help Center および File ExchangePolygons についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by