Simple Way To Control Mouse Using Java Object in Matlab
Simple Way To Control Mouse Using Java Object in Matlab
2011
Matlab also provide functions to control mouse moving automatically. One of them is by using Java object. Steps you have to follow are: Call Java Object (by importing Java Robot). Make dynamic coordinat for mouse. Command mouse to move according coordinat given.
See ?, this is very simple. Ok, below is a demo how to use this java object to control your mouse. 1. These code show you how to import java object.
%% importing java import java.awt.Robot; import java.awt.event.*; mouse=Robot; %%
2. I made dynamic function for relocating mouse coordinat. I hope you understand what this code does.
%% making coordinat and control mouse myscreen=get(0,'screensize'); x=myscreen(3); y=myscreen(4); for t=1:20:x coor=200*sin(t); pause(0.1); mouse.mouseMove(t,y/2+coor); end %% end
3. Above, you can see that i use mouse.mouseMove to relocate new coordinat for mouse. So your mouse will move according coordinat resulted from your function.
Im gonna prepare new program about how to move our mouse implementing function java object which controlled by catched object from webcam.
% originale % by jans hendry % EE&IT UGM, Indonesia