필터 지우기
필터 지우기

clicking on specific pixels on the screen

조회 수: 4 (최근 30일)
alex
alex 2012년 1월 17일
편집: Walter Roberson 2015년 12월 10일
I want to write a code in matlab,and I'm not sure which function can help me and which I need to write -
first step- a code that shows me the coordinates of the pixel where the pointer of the mouse is, I have written a code that shows me the coordinates of the pointer every x seconds but i want it to show me the coordinates only when i press the write\left mouse buttons.
import java.awt.*;
import java.awt.event.*;
mouse = Robot;
tic
for i = 1:500
get(0,'PointerLocation')
pause(0.1);
end;
second step- a code that clicks on specific pixels on the screen(not some figure of matlab) ,with a delay between each click- I have the general idea but I'm not sure -
import java.awt.*;
import java.awt.event.*;
mouse = Robot;
set(0,'PointerLocation',[2001, 467]);
for i = 1:200000
mouse.mousePress(InputEvent.BUTTON1_MASK);
mouse.mouseRelease(InputEvent.BUTTON1_MASK);
pause(0.00001);
end;
third step- involving time delay between each click.
if u have any idea how to write those things or which func' to use it will help me..

채택된 답변

Sean de Wolski
Sean de Wolski 2012년 1월 17일
A couple of places to look:
doc ginput
docsearch figure properties
Specifically look at the currentpoint option as well as the windowbuttonmotionfcn and windowbuttondownfcn

추가 답변 (1개)

Doug Hull
Doug Hull 2012년 1월 17일
It is not clear to me what you want to do. However, I think that you are going to be interested in these things:
  1. The 'currentPoint' property of the figure or axes.
  2. Timer objects.
Please edit your question to make it more clear what you mean, especially for the second step. Do not post your edits as a new answer to this question, or in the comments of your question. Just edit it.

카테고리

Help CenterFile Exchange에서 Graphics Performance에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by