2012-05-17 72 views

回答

9

您必須首先通過手柄來聲明你的身材:

fig = figure; 

,那麼你可以設置屬性(以下引號)即可激活您已經寫入功能響應用戶的相互作用(與@符號):

set(fig,'KeyPressFcn',@keyDownListener) 
set(fig, 'KeyReleaseFcn', @keyUpListener); 
set(fig,'WindowButtonDownFcn', @mouseDownListener); 
set(fig,'WindowButtonUpFcn', @mouseUpListener); 
set(fig,'WindowButtonMotionFcn', @mouseMoveListener); 

上面的例子是從shooter03.ma MATLAB空間射擊,的極好來源(來自MATLAB文件交換),用於在MATLAB用戶對象相互作用的許多方面:

http://www.mathworks.com/matlabcentral/fileexchange/31330-daves-matlab-shooter/content/shooter03/shooter03.m

1

嘗試:

hf = figure; 
get(hf,'CurrentCharacter')